cpuch/barcode-validator

Simple validator to check for correctly formatted UPC or EAN barcodes.

v1.0.7 2025-06-02 12:08 UTC

This package is auto-updated.

Last update: 2025-07-02 12:20:20 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Simple validator to check for correctly formatted UPC or EAN barcodes.

Installation

You can install the package via composer:

composer require cpuch/barcode-validator

You can publish the translations files with:

php artisan vendor:publish --tag="barcode-validator-translations"

Usage

In a controller you can use the class as a validator rule like this :

use Cpuch\BarcodeValidator\Rules\BarcodeValidatorRule;

$request->validate([
    'barcode' => ['required', new BarcodeValidatorRule],
]);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.