PHP Barcode Generator

$4/yr

Single Licence: a single website (personal, client), or intranet site project - Details

Extended Licence: a website (commercial, personal, client), or internet site project - Details

Rated

Be the first to review this.

Save for later

Save this link to facebook.

Get Social

Hit like and share it with others.

CREATED

06-Jul-2021

LAST UPDATED

06-Jul-2021

Compatible Browsers

,

DOCUMENTATION

LAYOUT

FILES INCLUDED

zip,

Seller Store

github

github

121

Sales

0

Comments

121+

Downloads

0

Rated Points

PHP Barcode Generator

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 based on the TCPDF barcode generator by Nicola Asuni. This code is therefor licensed under LGPLv3.
No support for…
We do not support any 2D barcodes, like QR codes. We also only generate the ‘bars’ part of a barcode. If you want text of the code below the barcode, you could add it later to the output of this package.
Installation
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.
Usage
Initiate the barcode generator for the output you want, then call the ->getBarcode() routine as many times as you want.
getBarcode(‘081231723897’, $generator::TYPE_CODE_128);
The getBarcode() method accepts the following parameters:
$barcode String needed to encode in the barcode
$type Type of barcode, use the constants defined in the class
$widthFactor Width is based on the length of the data, with this factor you can make the barcode bars wider than default
$height The total height of the barcode in pixels
$foregroundColor Hex code as string, or array of RGB, of the colors of the bars (the foreground color)
Example of usage of all parameters:
getBarcode(‘081231723897’, $generator::TYPE_CODE_128, 3, 50, $redColor));
Image types
$generatorSVG = new PicqerBarcodeBarcodeGeneratorSVG(); // Vector based SVG
$generatorPNG = new PicqerBarcodeBarcodeGeneratorPNG(); // Pixel based PNG
$generatorJPG = new PicqerBarcodeBarcodeGeneratorJPG(); // Pixel based JPG
$generatorHTML = new PicqerBarcodeBarcodeGeneratorHTML(); // Pixel based HTML
$generatorHTML = new PicqerBarcodeBarcodeGeneratorDynamicHTML(); // Vector based HTML
Accepted barcode types
These barcode types are supported. All types support different character sets or have mandatory lengths. Please see wikipedia for supported chars and lengths per type.
Most used types are TYPE_CODE_128 and TYPE_CODE_39. Because of the best scanner support, variable length and most chars supported.
TYPE_CODE_39
TYPE_CODE_39_CHECKSUM
TYPE_CODE_39E
TYPE_CODE_39E_CHECKSUM
TYPE_CODE_93
TYPE_STANDARD_2_5
TYPE_STANDARD_2_5_CHECKSUM
TYPE_INTERLEAVED_2_5
TYPE_INTERLEAVED_2_5_CHECKSUM
TYPE_CODE_128
TYPE_CODE_128_A
TYPE_CODE_128_B
TYPE_CODE_128_C
TYPE_EAN_2
TYPE_EAN_5
TYPE_EAN_8
TYPE_EAN_13
TYPE_UPC_A
TYPE_UPC_E
TYPE_MSI
TYPE_MSI_CHECKSUM
TYPE_POSTNET
TYPE_PLANET
TYPE_RMS4CC
TYPE_KIX
TYPE_IMB
TYPE_CODABAR
TYPE_CODE_11
TYPE_PHARMA_CODE
TYPE_PHARMA_CODE_TWO_TRACKS
See example images for all supported barcode types
A note about PNG and JPG images
If you want to use PNG or JPG images, you need to install Imagick or the GD library. This package will use Imagick if that is installed, or fall back to GD. If you have both installed but you want a specific method, you can use $generator->useGd() or $generator->useImagick() to force your preference.
Examples
Embedded PNG image in HTML
$generator = new PicqerBarcodeBarcodeGeneratorPNG();
echo ‘

Comments and Discussions



Reviews



Copyrights © 2021-2022 All Rights Reserved