PHPackages                             violuke/php-barcodes - 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. violuke/php-barcodes

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

violuke/php-barcodes
====================

A collection of PHP classes for managing barcodes.

v1.0.2(5y ago)39578.6k↓23.4%25[1 issues](https://github.com/violuke/php-barcodes/issues)2GPL-3.0+PHPPHP ^5.0 || ^7.0 || ^8.0CI failing

Since Jun 16Pushed 5y ago5 watchersCompare

[ Source](https://github.com/violuke/php-barcodes)[ Packagist](https://packagist.org/packages/violuke/php-barcodes)[ RSS](/packages/violuke-php-barcodes/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (2)

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/4941bb5cd3c51476e391f60191c402b62d98e923c4939eac9b9a3b80f6bf95f9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f76696f6c756b652f7068702d626172636f6465732e7376673f6d61784167653d33363030)](https://travis-ci.org/violuke/php-barcodes)[![Packagist](https://camo.githubusercontent.com/8eb2f2706c0a680081b0e628a9454aca4e92b9b8e75ebb8250b016f5bb98ef37/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76696f6c756b652f7068702d626172636f6465732e7376673f6d61784167653d33363030)](https://github.com/violuke/php-barcodes)[![Packagist](https://camo.githubusercontent.com/d0fe1441d9db94e8afe917616c88ed9b8eb75079e29f082890e6f28f59da6cd4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76696f6c756b652f7068702d626172636f6465732e7376673f6d61784167653d33363030)](https://github.com/violuke/php-barcodes)[![Packagist](https://camo.githubusercontent.com/387d20bf0da2ca7df1e4a7ac36cf675c4f5e6be246de26fb2390eacc9927f698/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f76696f6c756b652f7068702d626172636f6465732e7376673f6d61784167653d33363030)](https://github.com/violuke/php-barcodes)[![Packagist](https://camo.githubusercontent.com/a4ec22a0713519cdd1130c25e4308a2e92b64f132801368e4a151e8023b64b73/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f76696f6c756b652f7068702d626172636f6465732e7376673f6d61784167653d33363030)](https://github.com/violuke/php-barcodes)[![PHP 7 ready](https://camo.githubusercontent.com/6056bc1b2bd0e644122799ccc45f6e0ebce1a808ca432ee3ccd390f95897cc75/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f76696f6c756b652f7068702d626172636f6465732f6d61737465722f62616467652e737667)](https://travis-ci.org/violuke/php-barcodes)

*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 violuke/php-barcodes

```

Usage
-----

[](#usage)

```
// Class instantation
$barcode = '5060411950139';
$bc_validator = new \violuke\Barcodes\BarcodeValidator($barcode);

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

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

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

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

TODO:
-----

[](#todo)

- Barcode generation
- GS1-128 barcode generation and interpretation

Credits
-------

[](#credits)

- 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

44

—

FairBetter than 92% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity50

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 96.7% 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 ~885 days

Total

3

Last Release

1852d ago

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

v1.0.2PHP ^5.0 || ^7.0 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/916b54090a031ca520c8c10859bc1f999387c3f955c36b12f7edd96fb459a8c5?d=identicon)[violuke](/maintainers/violuke)

---

Top Contributors

[![violuke](https://avatars.githubusercontent.com/u/6420347?v=4)](https://github.com/violuke "violuke (29 commits)")[![dakorpar](https://avatars.githubusercontent.com/u/9303856?v=4)](https://github.com/dakorpar "dakorpar (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/violuke-php-barcodes/health.svg)

```
[![Health](https://phpackages.com/badges/violuke-php-barcodes/health.svg)](https://phpackages.com/packages/violuke-php-barcodes)
```

###  Alternatives

[ylsideas/feature-flags

A Laravel package for handling feature flags

6201.4M3](/packages/ylsideas-feature-flags)[php-ai/php-ml

PHP-ML - Machine Learning library for PHP

1061.7M12](/packages/php-ai-php-ml)[ssnepenthe/color-utils

A PHP library for performing SASS-like color manipulations.

631.1M10](/packages/ssnepenthe-color-utils)[wikimedia/at-ease

Safe replacement to @ for suppressing warnings.

1517.9M2](/packages/wikimedia-at-ease)[simplesamlphp/composer-module-installer

A Composer plugin that allows installing SimpleSAMLphp modules through Composer.

1310.4M160](/packages/simplesamlphp-composer-module-installer)[appsero/client

Appsero Client

25431.7k9](/packages/appsero-client)

PHPackages © 2026

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