Search by

beziworld / laravel-ifirma

kamcw

iFirma API client for Laravel: HMAC-signed requests, domestic VAT invoices, bills, PDF, e-mail, payments and KSeF submission.

Package info

github.com/Beziworld/laravel-ifirma

Homepage

Issues

pkg:composer/beziworld/laravel-ifirma

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

v1.0.0 2026-11-04 15:08 UTC

This package is auto-updated.

Last update: 2026-11-04 16:36:29 UTC


README

tests Latest Version License

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.

Polska wersja dokumentacji

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.

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.