PHPackages                             cedcommerce/validator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. cedcommerce/validator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cedcommerce/validator
=====================

A collection of PHP classes for managing barcodes.

2.2.0(4y ago)175.6k↓39.1%4[2 PRs](https://github.com/cedcommerce/validator/pulls)GPL-3.0+PHPPHP ^5.0 || ^7.0 || ^8.0

Since Jun 16Pushed 4y ago2 watchersCompare

[ Source](https://github.com/cedcommerce/validator)[ Packagist](https://packagist.org/packages/cedcommerce/validator)[ RSS](/packages/cedcommerce-validator/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (1)Versions (8)Used By (0)

PHP Barcode
===========

[](#php-barcode)

A PHP class for checking EAN8, EAN13, UPC and GTIN barcodes are valid (based on check digit).

[![Travis CI](https://camo.githubusercontent.com/93e9dfb1fe21a06d2f7e962698e7b30704f6db83daa90efae5de5153d3e41002/68747470733a2f2f7472617669732d63692e6f72672f6d696c696e6473696e67682f76616c696461746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/milindsingh/validator)[![Packagist](https://camo.githubusercontent.com/c6e454655f77e9210d955bbb7f7b561ed8b4fc597707d08b89db2a84667120ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696c696e6473696e67682f76616c696461746f722e7376673f6d61784167653d33363030)](https://github.com/milindsingh/validator)[![Packagist](https://camo.githubusercontent.com/2664a641b443cf31fad8c812b2ce5a59ba634840b22410c348b684e571f3e65c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696c696e6473696e67682f76616c696461746f722e7376673f6d61784167653d33363030)](https://github.com/milindsingh/validator)[![Packagist](https://camo.githubusercontent.com/dc792351478e9bd7b543ad8732bca801dd589278f630580f3ea83479b0f7393f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d696c696e6473696e67682f76616c696461746f722e7376673f6d61784167653d33363030)](https://github.com/milindsingh/validator)[![Packagist](https://camo.githubusercontent.com/551160c731932270c5590affcd04c3f3db8fcd1df563e4ada5380a572502a422/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d696c696e6473696e67682f76616c696461746f722e7376673f6d61784167653d33363030)](https://github.com/milindsingh/validator)[![PHP 7 ready](https://camo.githubusercontent.com/f780983ec36eb370ef5ccc7b62e4d42ccd9eab95015225366a7186051621ba5e/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f6d696c696e6473696e67682f76616c696461746f722f6d61737465722f62616467652e737667)](https://travis-ci.org/milindsingh/validator)

*Note: This project currently does nothing other than have some validation functions. I expect to add additional functionality in the future.*

Installation (with composer)
----------------------------

[](#installation-with-composer)

```
composer require cedcommerce/validator

```

Usage
-----

[](#usage)

```
// Class instantation
$barcode = '5060411950139';
$validator = new \Ced\Validator\Barcode();
$validator->setBarcode($barcode);

// Check barcode is in valid format
if ($validator->isValid()) {
	echo 'Valid :)';
} else {
	echo 'Invalid :(';
}

// Get the barcode type
echo 'Barcode is in format of ' . $validator->getType();
// Possible formats returned are:
// (string) "GTIN" which equals constant \Ced\Validator\Barcode::TYPE_GTIN
// (string) "EAN-8" which equals constant \Ced\Validator\Barcode::TYPE_EAN_8
// (string) "EAN" which equals constant \Ced\Validator\Barcode::TYPE_EAN
// (string) "EAN Restricted" which equals constant \Ced\Validator\Barcode::TYPE_EAN_RESTRICTED
// (string) "UPC" which equals constant \Ced\Validator\Barcode::TYPE_UPC
// (string) "UPC Coupon Code" which equals constant \Ced\Validator\Barcode::TYPE_UPC_COUPON_CODE

// Returns the barcode in GTIN-14 format
$validator->getGTIN14()

// Returns the barcode as entered
$validator->getBarcode()
```

TODO:
-----

[](#todo)

- Barcode generation
- GS1-128 barcode generation and interpretation

Credits
-------

[](#credits)

- The original package was created by [Luke Cousins](https://github.com/violuke).
- The barcode validation function was based on [work by Ferry Bouwhuis](http://www.phpclasses.org/package/8560-PHP-Detect-type-and-check-EAN-and-UPC-barcodes.html).
- EAN Restricted format added from the [hassel-it/php-barcodes](https://github.com/hassel-it/php-barcodes) fork.
- Initial unit tests based on work in the [hassel-it/php-barcodes](https://github.com/hassel-it/php-barcodes) fork.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 60% 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.

###  Release Activity

Cadence

Every ~364 days

Recently: every ~321 days

Total

7

Last Release

1485d ago

Major Versions

v1.0.1 → 2.0.02018-12-05

PHP version history (2 changes)v1.0PHP ^5.0 || ^7.0

2.2.0PHP ^5.0 || ^7.0 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13949703?v=4)[Milind Singh](/maintainers/milindsingh)[@milindsingh](https://github.com/milindsingh)

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

---

Top Contributors

[![violuke](https://avatars.githubusercontent.com/u/6420347?v=4)](https://github.com/violuke "violuke (27 commits)")[![milindsingh](https://avatars.githubusercontent.com/u/13949703?v=4)](https://github.com/milindsingh "milindsingh (17 commits)")[![harshityd](https://avatars.githubusercontent.com/u/54582756?v=4)](https://github.com/harshityd "harshityd (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cedcommerce-validator/health.svg)

```
[![Health](https://phpackages.com/badges/cedcommerce-validator/health.svg)](https://phpackages.com/packages/cedcommerce-validator)
```

PHPackages © 2026

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