PHP Classes

PHP Barcode Validator: Validate bar codes in several formats

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 129 All time: 9,378 This week: 206Up
Version License PHP version Categories
code-validator 1.0.1MIT/X Consortium ...5.3PHP 5, Validation
Description 

Author

This package can validate bar codes in several formats.

It takes as parameter a string with a bar code in a supported format and returns a result telling of the code is valid or invalid.

Currently it supports the formats: EAN, IMEI, ISBN, GTIN, SSCC, GSIN, UPC and other similar codes.

Picture of Ivan Melgrati
  Performance   Level  
Innovation award
Innovation award
Nominee: 3x

 

Example

<?php
   
/**
     * @author Ivan Melgrati
     * @copyright 2018
     */
   
require_once ('../src/barcode-validator.php');

   
$code = '490154203237518';
    echo
'Is IMEI code "'.$code.'" valid? '. (BarcodeValidator::IsValidIMEI($code) ? 'true' : 'false'). '<br>';
   
   
$code = '9780596100674';
    echo
'Is ISBN "'.$code.'" valid? '. (BarcodeValidator::IsValidISBN($code) ? 'true' : 'false'). '<br>';
?>


Details

BarcodeValidator

GitHub license GitHub release Total Downloads GitHub issues GitHub stars

A PHP class for validating EAN, IMEI, ISBN, GTIN, SSCC, GSIN, UPC and other similar codes.

Developed by Ivan Melgrati

Requirements

  • PHP >= 5.3.0

Installation

Composer

The recommended installation method is through Composer, a dependency manager for PHP. Just add imelgrat/barcode-validator to your project's composer.json file:

{
    "require": {
        "imelgrat/barcode-validator": "*"
    }
}

More details can be found over at Packagist.

Manually

  1. Copy `src/barcode-validator.php` to your codebase, perhaps to the `vendor` directory.
  2. Add the `BarcodeValidator` class to your autoloader or `require` the file directly.

Feedback

Please open an issue to request a feature or submit a bug report. Or even if you just want to provide some feedback, I'd love to hear. I'm also available on Twitter as @imelgrat.

Contributing

  1. Fork it.
  2. Create your feature branch (`git checkout -b my-new-feature`).
  3. Commit your changes (`git commit -am 'Added some feature'`).
  4. Push to the branch (`git push origin my-new-feature`).
  5. Create a new Pull Request.

  Files folder image Files (65)  
File Role Description
Files folder imagedocs (2 files, 9 directories)
Files folder imageexamples (1 file)
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpdoc.dist.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file VERSION Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:129
This week:0
All time:9,378
This week:206Up