Giter VIP home page Giter VIP logo

gs1-decoder's Introduction

GS1-128 (EAN128) Decoder

Basic GS1-128 (EAN128) decoder in PHP.

Installation

composer require nextgen-tech/gs1-decoder

Run Tests

# run PHPUnit tests
vendor/bin/phpunit

# run PHPStan analyse
vendor/bin/phpstan analyse

To run all tests automatically on several platforms you can use act, which mimics GitHub Actions locally:

$ act -P ubuntu-latest=shivammathur/node:latest

Usage

use NGT\Barcode\GS1Decoder\Decoder;

$decoder = new Decoder($delimiter = '[FNC1]');
$barcode = $decoder->decode('0195012345678903422616[FNC1]3103000123');

print_r($barcode->toArray());
Array
(
    [value] => 0195012345678903422616[FNC1]3103000123
    [delimiter] => [FNC1]
    [identifiers] => Array
        (
            [01] => Array
                (
                    [code] => 01
                    [title] => GTIN
                    [name] => Global Trade Item Number
                    [length] => 14
                    [content] => 95012345678903
                    [raw_content] => 95012345678903
                )

            [422] => Array
                (
                    [code] => 422
                    [title] => ORIGIN
                    [name] => Country of origin of a trade item
                    [length] => 3
                    [content] => 616
                    [raw_content] => 616
                )

            [310] => Array
                (
                    [code] => 310
                    [title] => NET WEIGHT (kg)
                    [name] => Net weight, kilograms
                    [length] => 6
                    [content] => 0.123
                    [raw_content] => 000123
                    [decimals] => 3
                )

        )

)

List of implemented identifiers

Identifier Title Description
00 SSCC Serial Shipping Container Code
01 GTIN Global Trade Item Number (GTIN)
02 CONTENT GTIN of contained trade items
10 BATCH/LOT Batch or lot number
11 PROD DATE Production date
12 DUE DATE Due date
13 PACK DATE Packaging date
15 BEST BEFORE Best before date
16 SELL BY Sell by date
17 USE BY Expiration date
20 VARIANT Internal product variant
21 SERIAL Serial number
91 INTERNAL Company internal information
422 ORIGIN Country of origin of a trade item
3100-3105 NET WEIGHT (kg) Net weight, kilograms
3920-3929 PRICE Applicable amount payable, single monetary area (variable measure trade item)
8005 PRICE PER UNIT Price per unit of measure
8008 PROD TIME Date and time of production

The list of all GS1 Application Identifiers can be found here

gs1-decoder's People

Contributors

dartui avatar laulaman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gs1-decoder's Issues

How to decoder GS1 DataMatrix?

I'm looking for a library that can be used with PHP without using any framework, but I realized that there is no tool for it.

I have observed that your work can decode the code but I cannot use it without the phpunit frame. Could you explain or implement the change to use it without using any framework?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.