busaeed/zatca-tools 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

PHP Version License: MIT Packagist

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

  1. This is not an official library. It was built independently and is not approved or maintained by ZATCA.
  2. 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.
  3. You should always follow ZATCA's official sample XML structures. Customizing them may cause errors or rejection.
  4. 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

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-06