1. Go to this page and download the library: Download sglms/gs1-gtin 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/ */
// Save barcode
$gtin->saveBarcode('path/barcode');
// Save barcode with numbers
$gtin->saveWithNumber('../resources/images/gtin12_numbers');
echo "<img src='../resources/images/gtin12_numbers.jpg'/>";
use Sglms\Gs1Gtin\Gtin8;
$gtin = Gtin8::create(
itemNumber: 123,
companyPrefix: '4567'
);
echo $gtin;
// GTIN-8 / EAN-8: 45671234
// Save barcode
$gtin->barcode();
$gtin->saveBarcode('../resources/images/gtin8');
echo "<img src='../resources/images/gtin8.jpg' />";
// Save barcode with numbers
$gtin->saveWithNumber('../resources/images/gtin8_numbers');
echo "<img src='../resources/images/gtin8_numbers.jpg'/>";
use Sglms\Gs1Gtin\Gs1;
$gs1 = Gs1::parse('(01)10012345678902(10)ABC123(3201)000500(3302)000700(17)250630(21)SN123456(37)10(11)230101');
echo $gs1;
// GS1: (01)10012345678902(10)ABC123(3102)002268(3302)000700(11)230101(17)250630(21)SN123456(37)10
// Display (SVG)
echo $gs1->barcode(showNumbers:true);
// Or, you can save a JPG image with numbers
$gs1->saveBarcode('../resources/images/images/gs1', ['01','37', '21','3102','3302'], 80);