2017 © Pedro Peláez
 

library gtin-validator

Real GTIN Validator

image

real-digital/gtin-validator

Real GTIN Validator

  • Wednesday, May 30, 2018
  • by aazon
  • Repository
  • 3 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Real GTIN Validator

Latest Stable Version Build Status Coverage Status, (*1)

A GTIN is a string of digits that uniquely identifies a trade item (a product that is bought and sold). A GTIN is globally unique, meaning that no two products in the world share the same GTIN., (*2)

This library provides a straightforward way by which a number can be determined to be a valid GTIN or suspected of being invalid in some way., (*3)

Installation

via Composer, (*4)

``` bash $ composer require real-digital/gtin-validator, (*5)


via GitHub ``` bash $ git clone https://github.com/real-digital/gtin-validator.git

Usage

<?php

use Real\Validator\Gtin;

// create a valid GTIN
$value = '4006381333931';
$gtin = Gtin\Factory::create($value);


// handle errors
$value = 'any invalid value';
try {
    $gtin = Gtin\Factory::create($value);
} catch (Gtin\NonNormalizable $e) {
    // ...
}


// check whether GTIN is valid
$value = '4006381333931';
$isValid = Gtin\Factory::isValid($value);

GTIN interface overview

Each created GTIN implements a common interface. This is a complete list of its methods:, (*6)

Method Type Functionality
checkDigit() integer Retrieve the rightmost digit called the "Check Digit"
indicator() integer Retrieve the "Indicator" component
key() string Retrieve GTIN value having a length corresponding to its variation
length() integer Retrieve length of the variation
origin() string Retrieve an origin value used for GTIN creation
padded() string Retrieve key padded to 14 digits
prefix() string Retrieve GS1 Prefix
variation() string Retrieve variation name

Testing

bash $ composer tests, (*7)

License

Real GTIN Validator is licensed under The Apache License 2.0. Please see LICENSE for details., (*8)

Changelog

Please see CHANGELOG for more information., (*9)

The Versions

30/05 2018

dev-internalization

dev-internalization

Real GTIN Validator

  Sources   Download

Apache-2.0

The Requires

  • php ^7.1

 

The Development Requires

validator specification ean normalizer upc gtin

25/05 2018

dev-developer

dev-developer

Real GTIN Validator

  Sources   Download

Apache-2.0

The Requires

  • php ^7.1

 

The Development Requires

validator specification ean normalizer upc gtin

24/05 2018

dev-master

9999999-dev

Real GTIN Validator

  Sources   Download

Apache-2.0

The Requires

  • php ^7.1

 

The Development Requires

validator specification ean normalizer upc gtin

24/05 2018

1.0.0

1.0.0.0

Real GTIN Validator

  Sources   Download

Apache-2.0

The Requires

  • php ^7.1

 

The Development Requires

validator specification ean normalizer upc gtin