PHP code example of happy-beer / php-barcode-generator

1. Go to this page and download the library: Download happy-beer/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/ */

    

happy-beer / php-barcode-generator example snippets


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

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

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