busaeed/zatca-tools
最新稳定版本:v1.0.0
Composer 安装命令:
composer require busaeed/zatca-tools
包简介
ZATCA Tools is a small PHP library that helps with e-invoicing tasks like signing invoices and making QR codes for ZATCA. It's easy to use and can be extended later to support more features.
README 文档
README
ZATCA Tools is a small PHP library that helps with e-invoicing tasks like signing invoices and making QR codes for ZATCA. It's easy to use and can be extended later to support more features.
🔔 Important Notes
- This is not an official library. It was built independently and is not approved or maintained by ZATCA.
- It was tested using all official ZATCA sample invoices, and results matched those from the official Fatoora SDK. However, use it at your own risk.
- You should always follow ZATCA's official sample XML structures. Customizing them may cause errors or rejection.
- If you find a bug or need help, feel free to open a GitHub issue or contact me on LinkedIn.
📋 Requirements
- PHP 8.0 or higher
- OpenSSL extension enabled
📦 Installation
Use Composer to install:
composer require busaeed/zatca-tools
📘 Phase 1 — Generate QR Code Only
This example generates a ZATCA Phase 1 compliant QR code in Base64:
use Zatca\Tools\ZatcaQrCodeBuilder; use Zatca\Tools\ZatcaQrCode; $qrBuilder = (new ZatcaQrCodeBuilder()) ->setSellerName('Test Seller') ->setVatNumber('300000000000003') ->setTimestamp('2025-06-28T23:59:59') ->setInvoiceTotal('115.00') ->setVatTotal('15.00'); $qrCodeBase64 = ZatcaQrCode::generate($qrBuilder);
📘 Phase 2 — Sign Invoice (With QR Code Included)
This example signs a UBL XML invoice and adds the Phase 2 digital signature and QR code automatically:
use Zatca\Tools\ZatcaInvoiceSigner; $signer = new ZatcaInvoiceSigner( $derPrivateKeyBase64, // Base64-encoded EC Private Key (DER format) $derX509CertificateBase64, // Base64-encoded X.509 Certificate (DER format) $unsignedXmlInvoice // The original UBL XML invoice as a string ); $signedXmlInvoice = $signer->prepareSignedInvoice();
👤 Author
Made by MOHAMMED BU SAEED
📦 View on Packagist
💬 Contact on LinkedIn
📝 License
MIT License
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-06