PHP code example of substacks / php-barcode-generator

1. Go to this page and download the library: Download substacks/php-barcode-generator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

substacks / php-barcode-generator example snippets


$coupon_code_styles = 'text-align:center;font-size:12px;position:relative;top:30px;letter-spacing:6px;left:3px;';
$generator = new Picqer\Barcode\BarcodeGeneratorHTML();
echo $generator->getBarcode($coupon_code, $generator::TYPE_STANDARD_2_5, true, $coupon_code_styles, 20, $widthFactor = 2, $totalHeight = 30, $color = 'black');

$generator = new Picqer\Barcode\BarcodeGeneratorHTML();
echo $generator->getBarcode('081231723897', $generator::TYPE_CODE_128);

$generatorSVG = new Picqer\Barcode\BarcodeGeneratorSVG();
$generatorPNG = new Picqer\Barcode\BarcodeGeneratorPNG();
$generatorJPG = new Picqer\Barcode\BarcodeGeneratorJPG();
$generatorHTML = new Picqer\Barcode\BarcodeGeneratorHTML();

$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
echo '<img src="data:image/png;base64,' . base64_encode($generator->getBarcode('081231723897', $generator::TYPE_CODE_128)) . '">';

composer