|
pirms 8 gadiem | |
---|---|---|
.. | ||
src | pirms 8 gadiem | |
.gitignore | pirms 9 gadiem | |
Readme.md | pirms 9 gadiem | |
composer.json | pirms 9 gadiem | |
examples.php | pirms 9 gadiem |
This is an easy to use, non-bloated, framework independent, barcode generator in PHP.
It creates SVG, PNG, JPG and HTML images, from the most used 1D barcode standards.
The codebase is largely from the TCPDF barcode generator. It is still a bit of a mess, bit I will clean it in the future. I do not expect the interface of this class will change during the clean ups.
Install through composer:
composer require picqer/php-barcode-generator
Initiate the barcode generator for the output you want, then call the ->getBarcode() routine as many times as you want.
$generator = new Picqer\Barcode\BarcodeGeneratorHTML();
echo $generator->getBarcode('081231723897', $generator::TYPE_CODE_128);
The ->getBarcode() routine accepts the following:
$generatorSVG = new Picqer\Barcode\BarcodeGeneratorSVG();
$generatorPNG = new Picqer\Barcode\BarcodeGeneratorPNG();
$generatorJPG = new Picqer\Barcode\BarcodeGeneratorJPG();
$generatorHTML = new Picqer\Barcode\BarcodeGeneratorHTML();
Embedded PNG image in HTML:
$generator = new Picqer\Barcode\BarcodeGeneratorPNG();
echo '<img src="data:image/png;base64,' . base64_encode($generator->getBarcode('081231723897', $generator::TYPE_CODE_128)) . '">';