Quick Start Guide

Requirements

Before installation, ensure your system meets the following requirements:

  • PHP ^7.4|^8.0

  • Laravel ^8.0|^9.0|^10.0

  • OpenSSL Extension

  • JSON Extension

  • DOM Extension

  • cURL Extension

Installation & Setup

composer require hazem7575/zatca

php artisan vendor:publish --provider="Hazem\Zatca\ZatcaServiceProvider"


2. Run migrations:


php artisan migrate
`

Add the following to your `.env` file:

Basic Usage

Device Registration

First, add the HasZatcaDevice trait to your model:

Then register your device:

Invoice Creation

Add the HasZatcaInvoice trait to your model:

Create invoices using the fluent interface:

Submit Invoices

There are two ways to submit invoices to ZATCA: basic submission and custom data submission.

Using the basic submission method:

Or submit with custom data:

Check Invoice Status

Monitor your invoice status using these methods:

Available Methods

Device Operations

Invoice Operations

Database Structure

The package creates three main tables:

Security

The package implements comprehensive security measures:

  • Row Level Security (RLS) enabled for all tables

  • Hash chaining for invoice integrity

  • Secure storage of private keys and secrets

  • Authentication required for all operations

  • Data access controlled through policies

Contributing & License

This package is open-source software licensed under the MIT license. Contributions are welcome - please feel free to submit Pull Requests on our GitHub repository.

Last updated