Download the PHP package corecave/laravel-zatca without Composer

On this page you can find all versions of the php package corecave/laravel-zatca. 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 laravel-zatca

Laravel ZATCA

A comprehensive Laravel package for integrating with Saudi Arabia's ZATCA (Zakat, Tax and Customs Authority) e-invoicing system (FATOORA platform).

This package supports Phase 2 requirements including:

Requirements

Installation

The package is on Packagist:

Publish the configuration file:

The package ships no migrations. Each workshop keeps its own certificates, invoice counter and hash chain in its own schema, so the host app keeps the two table migrations with its workshop migrations (database/migrations/tenant in Syanat) and runs them per workshop:

An app whose one seller keeps its device centrally, while a tenant's connection is the default, keeps the two tables with its central migrations instead and names its central connection in ZATCA_DB_CONNECTION: the certificates, the chain and the chain's lock all use it.

Configuration

Add these environment variables to your .env file:

Environments

The package supports three environments:

Environment Endpoint Certificate Issuer Purpose
sandbox developer-portal CN=eInvoicing (mock) Basic development testing
simulation simulation CN=TSZEINVOICE-SubCA-1, DC=extgazt, DC=gov, DC=local Real testing with ZATCA
production core CN=PEZEINVOICESCA2-CA, DC=extgazt, DC=gov, DC=local Live production

Important:

Onboarding Process

Step 1: Generate CSR

Step 2: Get Compliance CSID

  1. Log in to the FATOORA portal
  2. Generate an OTP for your EGS unit
  3. Run the compliance command:

Step 3: Get Production CSID

After passing compliance checks:

Usage

Creating a Simplified Invoice (B2C)

Creating a Standard Invoice (B2B)

For standard B2B invoices, buyer information is required and must include complete address details for Saudi Arabian buyers.

Buyer Identification Schemes

For the registration_scheme field, ZATCA accepts:

Scheme ID Description
CRN Commercial Registration Number
MOM Momra License
MLS MLSD License
SAG Sagia License
NAT National ID (10 digits)
GCC GCC ID
IQA Iqama Number
TIN Tax Identification Number (VAT)
700 700 Number
OTH Other ID

Required Buyer Address Fields for Saudi Arabia (BR-KSA-63)

When the buyer's country is SA, these fields are mandatory:

Field XML Element Description
street cbc:StreetName Street name (BT-50)
building cbc:BuildingNumber Building number - 4 digits (KSA-18)
postal_code cbc:PostalZone Postal code - 5 digits (BT-53)
city cbc:CityName City name (BT-52)
district cbc:CitySubdivisionName District name (KSA-4)
country cbc:IdentificationCode Country code (BT-55)

Creating Credit/Debit Notes

Auto-Processing Invoices

The process() method automatically determines whether to report or clear:

VAT Categories

Working with Certificates

Manual XML Generation

Hash Chain Management

Artisan Commands

Events

The package dispatches events you can listen to:

Debugging

Enable debug mode to save XML files and hashes for inspection:

Debug files are saved to storage/app/{ZATCA_DEBUG_PATH}/:

Error Handling

Common ZATCA Validation Errors

Error Code Message Solution
X509IssuerName wrong X509IssuerName Use simulation or production environment to get real certificates
X509SerialNumber wrong X509SerialNumber Certificate not from ZATCA - regenerate with real OTP
BR-KSA-F-13 Invalid Seller/Buyer ID Provide valid registration_number with correct registration_scheme
BR-KSA-63 Missing address fields Include all required fields: street, building, postal_code, city, district
BR-CL-KSA-14 QR Code exceeds 1000 chars Reduce invoice data or check QR generation

Changelog

v2.1.0 (2026-10-17)

Added

v2.0.0 (2026-10-17)

Changed

Every method now takes at most three parameters, so the long parameter lists moved into named value objects. The XML, hashes, QR codes and signatures the package produces are unchanged. Callers change as follows:

Added

v1.1.0 (2024-12-13)

Fixed

Changed

Added

v1.0.0 (2024-12-12)

License

MIT License. See LICENSE for more information.

Resources


All versions of laravel-zatca with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^13.0
illuminate/database Version ^13.0
phpseclib/phpseclib Version ^3.0
robrichards/xmlseclibs Version ^3.1
sabre/xml Version ^4.0
guzzlehttp/guzzle Version ^7.0|^8.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 corecave/laravel-zatca contains the following files

Loading the files please wait ...