PHP code example of beziworld / laravel-wfirma

1. Go to this page and download the library: Download beziworld/laravel-wfirma 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-wfirma example snippets


use Beziworld\WFirma\Data\InvoiceContent;
use Beziworld\WFirma\Data\InvoiceRequest;
use Beziworld\WFirma\Facades\WFirma;

$invoice = WFirma::createInvoice(new InvoiceRequest(
    contractor: [
        'name' => 'ACME Sp. z o.o.', 'nip' => '5261040828',
        'street' => 'Prosta 1', 'zip' => '00-001', 'city' => 'Warszawa', 'email' => '[email protected]',
    ],                                                // or an existing contractor id
    contents: [
        new InvoiceContent('Consulting', price: 1000.00, count: 2),
        new InvoiceContent('Training', price: 500.00, vat: 'zw'),
    ],
    paymentDate: now()->addDays(14),
    priceType: 'netto',                               // prices are net; "brutto" for gross prices
    attributes: ['id_external' => $order->number],
));

$invoice->fullNumber;   // "FV 1/11/2026"
$invoice->total;        // "2500.00"

WFirma::sendInvoice($invoice->id, '[email protected]', 'Your invoice');
$pdf = WFirma::pdf($invoice->id);

// conditions are combined with AND; "field operator" keys select other operators (ne, gt, lt, ge, le, like, in)
$result = WFirma::findInvoices(['Invoice.paymentstate' => 'unpaid', 'Invoice.date ge' => '2026-11-01'], page: 1, limit: 50);
$result['items'];   // list<Invoice>
$result['total'];

WFirma::findContractors(['Contractor.nip' => '5261040828']);
WFirma::findGoods(['Good.code' => 'SKU-1']);
WFirma::createContractor(['name' => 'ACME', 'nip' => '5261040828']);