Skip to content

GS1 Datamatrix parser for PHP compatible with official GS1 documentation

License

Notifications You must be signed in to change notification settings

lamoda/gs1-barcode-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lamoda GS1 Barcode parser and validator

Build Status Scrutinizer Code Quality Code Coverage Build Status

Installation

Composer

composer require lamoda/gs1-barcode-parser

Description

This library provides parsing of GS1 Barcodes according to GS1 General specification and GS1 DataMatrix Guideline.

Library also provides general purpose validator for barcode's content.

Usage

Parser

<?php

$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

Validator

<?php

$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());
}

About

GS1 Datamatrix parser for PHP compatible with official GS1 documentation

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages