PHP code example of mphpmaster / laravel-zatca

1. Go to this page and download the library: Download mphpmaster/laravel-zatca library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mphpmaster / laravel-zatca example snippets


$value = \MPhpMaster\ZATCA\TagBag::make()
    ->setCompany('Company name')
    ->setVatId('311111111111113')
    ->setInvoiceDate('2023-11-24T03:48:00Z')
    ->setInvoiceTotalAmount('100')
    ->setVatAmount('15')
    ->toBase64();

// > Output
// AQxDb21wYW55IG5hbWUCDzMxMTExMTExMTExMTExMwMUMjAyMy0xMS0yNFQwMzo0ODowMFoEAzEwMAUCMTU=

$value = \MPhpMaster\ZATCA\TagBag::make()
    ->setCompany('Company name')
    ->setVatId('311111111111113')
    ->setInvoiceDate('2023-11-24T03:48:00Z')
    ->setInvoiceTotalAmount('100')
    ->setVatAmount('15')
    ->toTLV();

$value = \MPhpMaster\ZATCA\TagBag::make()
    ->setCompany('Company name')
    ->setVatId('311111111111113')
    ->setInvoiceDate('2023-11-24T03:48:00Z')
    ->setInvoiceTotalAmount('100')
    ->setVatAmount('15')
    ->toImage();

// <img src="$value" alt="ZATCA QRCode" />