Download the PHP package saleh7/php-zatca-xml without Composer

On this page you can find all versions of the php package saleh7/php-zatca-xml. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-zatca-xml

php-zatca-xml

php Version Packagist Stars Packagist Downloads Packagist Version License

View Examples · Report a bug · Discussions

Production Tested — Full onboarding flow (CSR → Compliance → 6 Invoice Types → Production Certificate → Invoice Reporting) successfully tested against ZATCA production API on March 31, 2026 using Ubuntu 24.04 / PHP 8.4.

Introduction

PHP-ZATCA-XML is a PHP library for generating ZATCA-compliant e-invoices (Fatoora). It handles the full lifecycle: certificate generation, XML invoice creation, digital signing, QR codes, and API submission to ZATCA.

Built to match the official ZATCA Java SDK (R3.4.8) specifications: secp256k1 keys, SHA256withECDSA signatures, UBL 2.1 XML, and all three environment tiers.

Features

Requirements

Installation

Quick Start: Production Onboarding

The full ZATCA onboarding flow in 4 steps:

Step 1: Generate CSR + Private Key

📄 Full example: examples/Certificates/GeneratorCertificate.php

Environment options:

Step 2: Request Compliance Certificate (CCSID)

📄 Full example: examples/Certificates/RequestComplianceCertificate.php

Get an OTP from fatoora.zatca.gov.sa, then:

Step 3: Compliance Check (6 Invoice Types)

📄 Full automated example: examples/Certificates/ComplianceCheck.php

Submit 6 test invoices to pass compliance validation:

Required types: Standard Invoice, Standard Credit Note, Standard Debit Note, Simplified Invoice, Simplified Credit Note, Simplified Debit Note.

See examples/Certificates/ComplianceCheck.php for an automated script that generates, signs, and submits all 6 types.

Step 4: Request Production Certificate (PCSID)

📄 Included automatically in examples/Certificates/ComplianceCheck.php

After all 6 invoices pass:

Submitting Invoices

Reporting (B2C / Simplified)

📄 Full example: examples/InvoiceSimplified/simplified_invoice.php

Clearance (B2B / Standard)

📄 Full example: examples/InvoiceStandard/standard_invoice.php

Certificate Renewal

Invoice Generation

From Array (e-commerce integration)

Signing

API Reference

Method Endpoint Returns
requestComplianceCertificate($csr, $otp) POST /compliance ComplianceCertificateResult
validateInvoiceCompliance(...) POST /compliance/invoices ComplianceInvoiceResponse
requestProductionCertificate(...) POST /production/csids ProductionCertificateResult
renewProductionCertificate(...) PATCH /production/csids ProductionCertificateResult
submitReportingInvoice(...) POST /invoices/reporting/single ReportingResponse
submitClearanceInvoice(...) POST /invoices/clearance/single ClearanceResponse

All response objects extend ApiResponse with: isSuccess(), hasWarnings(), hasErrors(), getValidationStatus(), getWarningMessages(), getErrorMessages(), toArray().

Examples

File Description
Certificates/GeneratorCertificate.php Generate CSR + private key
Certificates/RequestComplianceCertificate.php Request compliance certificate
Certificates/ComplianceCheck.php Automated 6-invoice compliance + production cert
InvoiceSimplified/simplified_invoice.php Simplified invoice generation + signing
InvoiceStandard/standard_invoice.php Standard invoice generation + signing

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

Contributors

License

MIT License


All versions of php-zatca-xml with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-mbstring Version *
ext-dom Version *
ext-libxml Version *
ext-openssl Version *
ext-hash Version *
sabre/xml Version ^4.0
guzzlehttp/guzzle Version ^7.9
phpseclib/phpseclib Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package saleh7/php-zatca-xml contains the following files

Loading the files please wait ...