Stars: 109
Forks: 45
Pull Requests: 11
Issues: 15
Watchers: 29
Last Updated: 2023-07-22 23:30:48
An unofficial package maintained by Salla to help developers to implement ZATCA (Fatoora) QR code easily which required for e-invoicing
License: MIT License
Languages: PHP
An unofficial package maintained by Salla to help developers to implement ZATCA (Fatoora) QR code easily which required for e-invoicing
Explore our blogs »
Report Bug ·
Request Feature
· </Salla Developers>
You can install the package via composer:
$ composer require salla/zatca
use Salla\ZATCA\GenerateQrCode;
use Salla\ZATCA\Tags\InvoiceDate;
use Salla\ZATCA\Tags\InvoiceTaxAmount;
use Salla\ZATCA\Tags\InvoiceTotalAmount;
use Salla\ZATCA\Tags\Seller;
use Salla\ZATCA\Tags\TaxNumber;
$generatedString = GenerateQrCode::fromArray([
new Seller('Salla'), // seller name
new TaxNumber('1234567891'), // seller tax number
new InvoiceDate('2021-07-12T14:25:09Z'), // invoice date as Zulu ISO8601 @see https://en.wikipedia.org/wiki/ISO_8601
new InvoiceTotalAmount('100.00'), // invoice total amount
new InvoiceTaxAmount('15.00') // invoice tax amount
// TODO :: Support others tags
])->toBase64();
// > Output
// AQVTYWxsYQIKMTIzNDU2Nzg5MQMUMjAyMS0wNy0xMlQxNDoyNTowOVoEBjEwMC4wMAUFMTUuMDA=
use Salla\ZATCA\GenerateQrCode;
use Salla\ZATCA\Tags\InvoiceDate;
use Salla\ZATCA\Tags\InvoiceTaxAmount;
use Salla\ZATCA\Tags\InvoiceTotalAmount;
use Salla\ZATCA\Tags\Seller;
use Salla\ZATCA\Tags\TaxNumber;
$generatedString = GenerateQrCode::fromArray([
new Seller('Salla'), // seller name
new TaxNumber('1234567891'), // seller tax number
new InvoiceDate('2021-07-12T14:25:09Z'), // invoice date as Zulu ISO8601 @see https://en.wikipedia.org/wiki/ISO_8601
new InvoiceTotalAmount('100.00'), // invoice total amount
new InvoiceTaxAmount('15.00') // invoice tax amount
// TODO :: Support others tags
])->toTLV();
You can render the tags as QR code image easily
use Salla\ZATCA\GenerateQrCode;
use Salla\ZATCA\Tags\InvoiceDate;
use Salla\ZATCA\Tags\InvoiceTaxAmount;
use Salla\ZATCA\Tags\InvoiceTotalAmount;
use Salla\ZATCA\Tags\Seller;
use Salla\ZATCA\Tags\TaxNumber;
// data:image/png;base64, .........
$displayQRCodeAsBase64 = GenerateQrCode::fromArray([
new Seller('Salla'), // seller name
new TaxNumber('1234567891'), // seller tax number
new InvoiceDate('2021-07-12T14:25:09Z'), // invoice date as Zulu ISO8601 @see https://en.wikipedia.org/wiki/ISO_8601
new InvoiceTotalAmount('100.00'), // invoice total amount
new InvoiceTaxAmount('15.00') // invoice tax amount
// TODO :: Support others tags
])->render();
// now you can inject the output to src of html img tag :)
// <img src="$displayQRCodeAsBase64" alt="QR Code" />
The output of QR-Code is not readable for the human 👀, and some of QR-Code readers maybe show a invalid output because this QR-Code will be scan by the ZATCA apps later after the all steps of integration compete. If you interested to see the output of your final QR-Code Image you can use the following website
https://www.onlinebarcodereader.com/
We'll continue work on this package until support the whole cycle of QR code implementation.
composer test
The team is always here to help you. Happen to face an issue? Want to report a bug? You can submit one here on Github using the Issue Tracker. If you still have any questions, please contact us via the Telegram Bot or join in the Global Developer Community on Telegram.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)If you discover any securitys-related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.