2017 © Pedro Peláez
 

library product-code-validation

Product UPC, EAN and ISBN Validator

image

rottingham/product-code-validation

Product UPC, EAN and ISBN Validator

  • Monday, June 22, 2015
  • by rottingham
  • Repository
  • 1 Watchers
  • 1 Stars
  • 9,806 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 1 Versions
  • 6 % Grown

The README.md

ProductValidation

ProductValidator is a simply utility for Shopping cart software or custom projects to validate product codes., (*1)

Supports UPC-A, UPC-E 6, 7 and 8, EAN13 and ISBN10/ISBN13., (*2)

This software is free to use, distribute and change as you see fit according to the MIT Variant license., (*3)

Composer Ready, (*4)

Available on Packagist: https://packagist.org/packages/rottingham/product-code-validation, (*5)

Sample Usage

Simply import the ProductValidator.class.inc main class file if you are not utilizing auto loaders., (*6)

require '/ProductValidator.class.inc';

To use the validator, you can simply call its checkCode($code) method:, (*7)

$result = ProductValidator\ProductValidator::checkCode('1560213639');

var_dump($result);

checkCode attempts to smartly detect the codes type and returns and array containing the code type, (UPC, EAN, ISBN) the checkDigit for the code, and the isbn pieces if the code is an ISBN., (*8)

Individual Code Validation

To validate (TRUE|FALSE) a code you already know the type of, use ProductValidator's individual check functions:, (*9)

var_dump(ProductValidator\ProductValidator::checkUpc('748196000441');
var_dump(ProductValidator\ProductValidator::checkEan('9781560213635');
var_dump(ProductValidator\ProductValidator::checkIsbn('1560213635');

checkUpc, checkEan and checkIsbn return TRUE if the check digit and code validates, or FALSE if they do not., (*10)

Validators

  • UpcValidator
  • EanValidator
  • IsbnValidator

The Versions

22/06 2015

dev-master

9999999-dev https://github.com/rottingham/ProductValidation

Product UPC, EAN and ISBN Validator

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

ean isbn upc