PHPackages                             rottingham/product-code-validation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. rottingham/product-code-validation

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

rottingham/product-code-validation
==================================

Product UPC, EAN and ISBN Validator

1114.2k↓60%3[1 issues](https://github.com/rottingham/ProductValidation/issues)PHP

Since Jun 22Pushed 11y ago1 watchersCompare

[ Source](https://github.com/rottingham/ProductValidation)[ Packagist](https://packagist.org/packages/rottingham/product-code-validation)[ RSS](/packages/rottingham-product-code-validation/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

ProductValidation
=================

[](#productvalidation)

ProductValidator is a simply utility for Shopping cart software or custom projects to validate product codes.

Supports UPC-A, UPC-E 6, 7 and 8, EAN13 and ISBN10/ISBN13.

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

**Composer Ready**

Available on Packagist:

#### Sample Usage

[](#sample-usage)

Simply import the `ProductValidator.class.inc` main class file if you are not utilizing auto loaders.

```
require '/ProductValidator.class.inc';

```

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

```
$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.

#### Individual Code Validation

[](#individual-code-validation)

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

```
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.

#### Validators

[](#validators)

- UpcValidator
- EanValidator
- IsbnValidator

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4079423?v=4)[rottingham](/maintainers/rottingham)[@rottingham](https://github.com/rottingham)

---

Top Contributors

[![rottingham](https://avatars.githubusercontent.com/u/4079423?v=4)](https://github.com/rottingham "rottingham (27 commits)")[![ralphstoys](https://avatars.githubusercontent.com/u/4314053?v=4)](https://github.com/ralphstoys "ralphstoys (1 commits)")

### Embed Badge

![Health badge](/badges/rottingham-product-code-validation/health.svg)

```
[![Health](https://phpackages.com/badges/rottingham-product-code-validation/health.svg)](https://phpackages.com/packages/rottingham-product-code-validation)
```

###  Alternatives

[marcosh/php-validation-dsl

A DSL for validating data in a functional fashion

483.9k](/packages/marcosh-php-validation-dsl)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
