mphpmaster / laravel-zatca
Laravel辅助工具,用于生成ZATCA电子发票系统的QR码
1.0.2
2023-01-09 14:25 UTC
Requires
- php: >=7.4
- ext-mbstring: *
- chillerlan/php-qrcode: ^4.3
Requires (Dev)
- phpunit/phpunit: ~8.0
README
非官方包,用于实现ZATCA电子发票的QR码。
要求
- PHP >= 7.4
- mbstring扩展
依赖
安装
通过composer
$ composer require mphpmaster/laravel-zatca
用法
生成Base64
$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();
获取QR码图像
$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" />
测试
vendor/bin/phpunit
版权和许可证
版权 © 2023 hlaCk (https://github.com/mPhpMaster)
在MIT许可证下授权 (https://github.com/mPhpMaster/laravel-zatca/blob/master/LICENSE)