bluspark / dgfip-datamatrix

在PHP中生成DGFIP(法国税务机关)数据矩阵的方法。

v0.0.2 2024-04-22 05:51 UTC

This package is auto-updated.

Last update: 2024-09-21 09:35:29 UTC


README

在PHP中生成DGFIP数据矩阵(法国税务机关)的方法。

安装

使用composer

composer require bluspark/dgfip-datamatrix

使用方法

use Bluspark\DgfipDatamatrix\DataMatrixGenerator;
use Bluspark\DgfipDatamatrix\DataMatrixReference;

$reference = new DataMatrixReference();
$reference
    ->setEmitterCode("...")
    ->setEstablishmentCode("...")
    ->setRevenueCode("...")
    ->setAccountantCode("...")
    ->setFiscalYear("...")
    ->setInvoiceNumber("...")
    ->setAmountInCents("...")
    ;

$generator = new DataMatrixGenerator();
$datamatrix = $generator->generate($reference);


echo "The datamatrix code is: " . $datamatrix->asString();

生成图像

如果您想生成数据矩阵的图像,我们建议您安装jucksearm\\barcode

composer require jucksearm/barcode

然后您可以按如下方式生成图像:

// For a PNG image
$png = $datamatrix->asPng();
file_put_contents("datamatrix.png", $png);

// For a SVG image
$svg = $datamatrix->asSvg();
file_put_contents("datamatrix.svg", $svg);

许可证

本项目采用CeCILL-B许可证 - 请参阅LICENSE文件以获取详细信息。

赞助商

Bluspark logo

Bluspark是一个用于运营聚居区和城市基础设施的SaaS应用程序。它是一个从设计到维护的基础设施生命周期管理的完整解决方案。

Consoneo logo

用于融资和管理能源改造援助的数字SaaS平台