PHP code example of lamoda / gs1-barcode-parser
1. Go to this page and download the library: Download lamoda/gs1-barcode-parser 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/ */
lamoda / gs1-barcode-parser example snippets
$config = new \Lamoda\GS1Parser\Parser\ParserConfig();
$parser = new \Lamoda\GS1Parser\Parser\Parser($config);
$value = ']d201034531200000111719112510ABCD1234';
$barcode = $parser->parse($value);
// $barcode is an object of Barcode class
$parserConfig = new \Lamoda\GS1Parser\Parser\ParserConfig();
$parser = new \Lamoda\GS1Parser\Parser\Parser($parserConfig);
$validatorConfig = new \Lamoda\GS1Parser\Validator\ValidatorConfig();
$validator = new \Lamoda\GS1Parser\Validator\Validator($parser, $validatorConfig);
$value = ']d201034531200000111719112510ABCD1234';
$resolution = $validator->validate($value);
if ($resolution->isValid()) {
// ...
} else {
var_dump($resolution->getErrors());
}