|
|
4 years ago | |
|---|---|---|
| .. | ||
| src | 4 years ago | |
| tests | 4 years ago | |
| .gitignore | 4 years ago | |
| .travis.yml | 4 years ago | |
| LICENSE.md | 4 years ago | |
| Readme.md | 4 years ago | |
| composer.json | 4 years ago | |
| generate-verified-files.php | 4 years ago | |
| phpunit.xml | 4 years ago | |
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 by Nicola Asuni. This code is therefor licensed under LGPLv3. 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
If you want to generate PNG or JPG images, you need the GD library or Imagick installed on your system as well.
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)) . '">';