bluspark / dgfip-datamatrix
Way to generate, in PHP, a datamatrix for DGFIP (French tax administration).
Installs: 8 307
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/bluspark/dgfip-datamatrix
Requires (Dev)
- jucksearm/php-barcode: ^1.0
- phpunit/phpunit: ^10.5
Suggests
- jucksearm/php-barcode: To generate the datamatrix image.
This package is auto-updated.
Last update: 2026-01-21 12:50:40 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 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.
The digital SaaS platform for financing and managing energy renovation aid

