PHPackages                             busaeed/zatca-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. busaeed/zatca-tools

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

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.

v1.0.0(10mo ago)21MITPHPPHP &gt;=8.0

Since Jul 6Pushed 10mo agoCompare

[ Source](https://github.com/busaeed/zatca-tools)[ Packagist](https://packagist.org/packages/busaeed/zatca-tools)[ RSS](/packages/busaeed-zatca-tools/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

ZATCA Tools
===========

[](#zatca-tools)

[![PHP Version](https://camo.githubusercontent.com/f9a61eee600abfa4c06628ff826dc6a7dfffc0cceca828fd79751b43e44f451f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e302d626c75652e737667)](https://www.php.net/)[![License: MIT](https://camo.githubusercontent.com/4241bde638f7587c4f0f266d1afda72d8b1f5996feada99dec5f849d76136a34/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f627573616565642f7a617463612d746f6f6c733f7374796c653d666c61742d737175617265)](https://github.com/busaeed/zatca-tools/blob/main/LICENSE)[![Packagist](https://camo.githubusercontent.com/6cab0b0df37a9f9222dd772e34ea15991ffcdc32a9735e5ba58cf79e3c1ada8a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f627573616565642f7a617463612d746f6f6c73)](https://packagist.org/packages/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.

---

🔔 Important Notes
-----------------

[](#-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](https://www.linkedin.com/in/busaeed)**.

---

📋 Requirements
--------------

[](#-requirements)

- PHP 8.0 or higher
- OpenSSL extension enabled

---

📦 Installation
--------------

[](#-installation)

Use Composer to install:

```
composer require busaeed/zatca-tools
```

---

📘 Phase 1 — Generate QR Code Only
---------------------------------

[](#-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)
------------------------------------------------

[](#-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
--------

[](#-author)

Made by [MOHAMMED BU SAEED](https://github.com/busaeed)
📦 [View on Packagist](https://packagist.org/packages/busaeed/zatca-tools)
💬 [Contact on LinkedIn](https://www.linkedin.com/in/busaeed)

---

📝 License
---------

[](#-license)

MIT License

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance54

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

317d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/83c373b6fee1d520b3f42d63aef3c2db9bdaaf5b5f20865ca775470f94535f2f?d=identicon)[busaeed](/maintainers/busaeed)

---

Top Contributors

[![busaeed](https://avatars.githubusercontent.com/u/58543045?v=4)](https://github.com/busaeed "busaeed (11 commits)")

### Embed Badge

![Health badge](/badges/busaeed-zatca-tools/health.svg)

```
[![Health](https://phpackages.com/badges/busaeed-zatca-tools/health.svg)](https://phpackages.com/packages/busaeed-zatca-tools)
```

###  Alternatives

[sskaje/mqtt

sskaje's MQTT Class

8769.5k1](/packages/sskaje-mqtt)[birgir/geo-query

Modify the WP\_Query to support the geo\_query parameter. Uses the Haversine SQL optimization by Ollie Jones.

683.0k](/packages/birgir-geo-query)[breadlesscode/neos-blog

Ready to use blog package

161.4k](/packages/breadlesscode-neos-blog)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
