PHP code example of pinekta / php-jp-customer-barcode-generator

1. Go to this page and download the library: Download pinekta/php-jp-customer-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/ */

    

pinekta / php-jp-customer-barcode-generator example snippets




// SVG
$generator = new Pinekta\JPCustomerBarcode\BarcodeGeneratorSVG();
echo $generator->getBarcode('104-0045', '東京都中央区築地2-3-4');

// HTML
$generator = new Pinekta\JPCustomerBarcode\BarcodeGeneratorHTML();
echo $generator->getBarcode('104-0045', '東京都中央区築地2-3-4');

// PNG
$generator = new Pinekta\JPCustomerBarcode\BarcodeGeneratorPNG();
echo '<img src="data:image/png;base64,' . base64_encode($generator->getBarcode('104-0045', '東京都中央区築地2-3-4')) . '">');

// JPG
$generator = new Pinekta\JPCustomerBarcode\BarcodeGeneratorJPG();
echo '<img src="data:image/jpg;base64,' . base64_encode($generator->getBarcode('104-0045', '東京都中央区築地2-3-4')) . '">');