PHP code example of beziworld / laravel-infakt

1. Go to this page and download the library: Download beziworld/laravel-infakt library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

beziworld / laravel-infakt example snippets


use Beziworld\Infakt\Data\InvoiceRequest;
use Beziworld\Infakt\Data\Service;
use Beziworld\Infakt\Facades\Infakt;

$invoice = Infakt::createInvoice(new InvoiceRequest(
    services: [
        new Service('Website development', unitNetPrice: 500000, quantity: 1),         // amounts in grosze
        new Service('Hosting 12 months', grossPrice: 61500, taxSymbol: '23', unit: 'usł.'),
    ],
    clientCompanyName: 'ACME Sp. z o.o.',
    clientTaxCode: '5261040828',
    clientStreet: 'Prosta',
    clientStreetNumber: '1',
    clientPostCode: '00-001',
    clientCity: 'Warszawa',
    paymentDate: now()->addDays(14),
), sendToKsef: true);

$invoice->number;       // "1/11/2026"
$invoice->grossPrice;   // 676500 (grosze)

Infakt::sendByEmail($invoice->uuid);

$task = Infakt::createInvoiceAsync($request);   // returns immediately
// later
$task = Infakt::task($task->reference);
if ($task->isDone()) {
    $invoice = Infakt::invoice($task->invoiceUuid);
}

Infakt::invoices(['q[invoice_date_gteq]' => '2026-11-01'], offset: 0, limit: 100);   // ['items' => [...], 'total' => 37]
Infakt::pdf($uuid, 'original');               // binary PDF
Infakt::markAsPaid($uuid, now());             // asynchronous, waited for
Infakt::deleteInvoice($uuid);
Infakt::clients(['q[nip_eq]' => '5261040828']);
Infakt::createClient(['company_name' => 'ACME', 'nip' => '5261040828', 'country' => 'PL']);