Installation
Install the SDK in a Laravel application or any Composer-based PHP project.
Requirements
- PHP
8.1,8.2, or8.3. - Composer 2 and the PHP cURL extension.
- BCMath on the ZatcaX server for accurate invoice VAT calculations.
- Laravel is optional; auto-discovery is available when Laravel is present.
Install from the bundled path repository
Copy the SDK to packages/ZatcaSDK inside the consuming project, then register it as a local Composer path package:
composer config repositories.zatcax path ./packages/ZatcaSDK
composer require montju/zatca-sdk:@dev
Commit the consuming project's composer.json, composer.lock, and local package directory. Other environments can then install normally:
composer install
Laravel setup
Laravel discovers ZatcaServiceProvider and the Zatca Facade automatically. Publish the optional configuration file:
php artisan vendor:publish --tag=zatca-config
This creates config/zatca.php. No manual provider or alias registration is required.
Verify the installation
use ZatcaX\SDK\ZatcaClient;
$client = new ZatcaClient();
echo $client->getConfig()->getBaseUrl();
Important: The SDK is server-side software. Never place the client secret in browser JavaScript or a public repository.