beziworld / laravel-ifirma
iFirma API client for Laravel: HMAC-signed requests, domestic VAT invoices, bills, PDF, e-mail, payments and KSeF submission.
Requires
- php: ^8.3
- ext-json: *
- guzzlehttp/guzzle: ^7.8
- illuminate/contracts: ^12.0|^13.0
- illuminate/http: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^3.7|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
- phpstan/phpstan-strict-rules: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-04 16:36:29 UTC
README
iFirma API client for Laravel: HMAC-signed requests, domestic VAT invoices, invoice list, PDF, e-mail delivery, payment registration, KSeF submission, bills for non-VAT sales and API limits.
Installation
composer require beziworld/laravel-ifirma
php artisan vendor:publish --tag=ifirma-config # optional
IFIRMA_LOGIN=your-login # user with the "super konto" role IFIRMA_INVOICE_KEY=EAB0D8ACF3308F3B # key "faktura" (Settings > API) IFIRMA_BILL_KEY= # key "rachunek", for bills IFIRMA_SUBSCRIBER_KEY= # key "abonent", for limits
Issue an invoice
use Beziworld\IFirma\Data\Contractor; use Beziworld\IFirma\Data\InvoiceRequest; use Beziworld\IFirma\Data\Position; use Beziworld\IFirma\Facades\IFirma; $id = IFirma::createInvoice(new InvoiceRequest( contractor: new Contractor('ACME Sp. z o.o.', '00-001', 'Warszawa', nip: '5261040828', street: 'Prosta 1', email: 'faktury@acme.pl'), positions: [ new Position('Website development', unitPrice: 6150.00, quantity: 1, vatRate: 0.23), new Position('Training', unitPrice: 500.00, vatRate: null), // VAT exempt ], issueDate: now(), paymentDate: now()->addDays(14), paymentMethod: 'PRZ', // transfer; GTK cash, KAR card, P24, TPA, ... calculateFrom: 'BRT', // prices are gross; "NET" for net prices )); IFirma::sendByEmail($id); IFirma::sendToKsef($id); $pdf = IFirma::pdf($id);
Other operations
IFirma::invoices(from: now()->startOfMonth(), filters: ['status' => 'nieoplacone']); // includes KsefNumer, KsefStatus IFirma::invoice('12/2026'); // by identifier or number IFirma::registerPayment('12/2026', 246.00); // payment for a domestic invoice IFirma::limit(); // ['used' => 12, 'granted' => 1000] IFirma::createBill([...]); // rachunekkraj payload, key "rachunek" IFirma::call('POST', 'fakturawdt.json', 'faktura', [...]); // any other resource, signed with the given key
Exceptions
ApiException exposes the iFirma response code through iFirmaCode() (201 validation, 400-403 authentication,
500 missing permission), plus isValidationError() and isAuthenticationError(). iFirma reports most errors with
HTTP 200 and a non-zero Kod, which the client turns into exceptions.
Development
composer install
composer ci # pint --test, phpstan (level 8), pest
Author
Created and maintained by Kamil Ćwiertnia, beziworld.eu.
- E-mail: biuro@beziworld.eu
- Issues: GitHub issues
Need an invoicing or KSeF integration? Get in touch through beziworld.eu.
Other packages by the author
laravel-ksef · laravel-fakturownia · laravel-infakt · laravel-wfirma
License
MIT. See LICENSE.md. This package is not affiliated with iFirma.