Download the PHP package pmigut/gtin-validator without Composer
On this page you can find all versions of the php package pmigut/gtin-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pmigut/gtin-validator
More information about pmigut/gtin-validator
Files in pmigut/gtin-validator
Package gtin-validator
Short Description This library is a set of static methods for GTIN validation. Methods return true if given string is publicly available GTIN-8, GTIN-12, GTIN-13 or GTIN-14 code. Checks include format, check digit and prefix.
License MIT
Informations about the package gtin-validator
This library is a set of static methods for GTIN validation.
The library is best suited for quick validation of many codes without instantiating a new object for each code.
Simple true or false is returned and no additional details are provided on failure. Only trade product codes return true, codes with restricted or special use prefixes return false.
Supported codes
- GTIN-8 (former EAN-8)
- GTIN-12 (former UPC)
- GTIN-13 (former EAN-13)
- GTIN-14
Checks performed
- format
- check digit
- GS1 prefix
Implementation is based on GS1 General Specifications ver. 18, Jan 2018. Prefix list verified on 2 Jan 2026.
Requirements
- PHP 8.2 or later
- ext-ctype
Users on PHP < 8.2 should pin to ^1.0.
Installation
Examples
Basic usage
Strict types
isValid method expects string argument. If strict_types=1 is declared, isValid may throw TypeError.
Leading zeros
Codes are validated as is, no leading zeros are added.
Development
The simplest way to contribute is via the included Docker setup (no local PHP required):
If you have PHP 8.2+ and Composer installed locally, you can also run the tests directly:
License
This library is licensed under the MIT License, see LICENSE for details.
All versions of gtin-validator with dependencies
ext-ctype Version *