bluspark/dgfip-datamatrix

Way to generate, in PHP, a datamatrix for DGFIP (French tax administration).

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

This package is auto-updated.

Last update: 2024-12-21 10:19:56 UTC


README

Way to generate, in PHP, a datamatrix for DGFIP (French tax administration).

Installation

With composer:

composer require bluspark/dgfip-datamatrix

Usage

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();

Generating images

If you want to generate an image of the datamatrix, we suggest you to install the jucksearm\\barcode package:

composer require jucksearm/barcode

Then you can generate the image like this:

// 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);

License

This project is licensed under the CeCILL-B License - see the LICENSE file for details.

Sponsors

Bluspark logo

Bluspark is a Saas application to operate infrastructure of agglomerations and cities. It is a complete solution to manage the life cycle of your infrastructure, from the design to the maintenance.

Consoneo logo

The digital SaaS platform for financing and managing energy renovation aid