PHP code example of ayeo / gs1_barcode

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

    

ayeo / gs1_barcode example snippets


use Ayeo\Barcode;

$builder = new Barcode\Builder();
$builder->output('(10)123456(400)11');

use Ayeo\Barcode;

$builder = new Barcode\Builder();
$builder->setBarcodeType('gs1-128');
$builder->setFilename('barcode.png');
$builder->setImageFormat('png');
$builder->setWidth(500);
$builder->setHeight(150);
$builder->setFontPath('FreeSans.ttf');
$builder->setFontSize(15);
$builder->setBackgroundColor(255, 255, 255);
$builder->setPaintColor(0, 0, 0);

$builder->output('(10)123456(400)11');

$builder->saveImage('(10)123456(400)11');

$builder->output('(10)123456(400)11', $withLabel = false);
$builder->saveImage('(10)123456(400)11', $withLabel = false);

use Ayeo\Barcode;

Barcode\Builder::build()->setWidth(600)->setBackgroundColor(100, 100, 100)->output('(10)123456(400)11');

docker build -t php-gs1 .