ageekdev/laravel-barcode

laravel barcode generator

v1.2.0 2024-04-09 02:38 UTC

This package is auto-updated.

Last update: 2024-11-16 15:51:02 UTC


README

Latest Version on Packagist Laravel 9.x Laravel 10.x Laravel 11.x GitHub Tests Action Status Total Downloads

This package can generate SVG, PNG, JPG and HTML images from the most used 1D barcode standards. Here's how you can use it:

Installation

You can install the package via composer:

composer require ageekdev/laravel-barcode

You can publish the config file with:

php artisan vendor:publish --tag="laravel-barcode-config"

Usage

use AgeekDev\Barcode\Facades\Barcode;
use AgeekDev\Barcode\Enums\Type;

$barcode = Barcode::imageType("svg")
                ->foregroundColor("#000000")
                ->height(30)
                ->widthFactor(2)
                ->type(Type::TYPE_CODE_128)
                ->generate("081231723897");

Accepted barcode types

These barcode types are supported. All types support different character sets or have mandatory lengths. Please see wikipedia for supported chars and lengths per type.

Most used types are TYPE_CODE_128 and TYPE_CODE_39. Because of the best scanner support, variable length and most chars supported.

  • TYPE_CODE_32 (italian pharmaceutical code 'MINSAN')
  • TYPE_CODE_39
  • TYPE_CODE_39_CHECKSUM
  • TYPE_CODE_39E
  • TYPE_CODE_39E_CHECKSUM
  • TYPE_CODE_93
  • TYPE_STANDARD_2_5
  • TYPE_STANDARD_2_5_CHECKSUM
  • TYPE_INTERLEAVED_2_5
  • TYPE_INTERLEAVED_2_5_CHECKSUM
  • TYPE_CODE_128
  • TYPE_CODE_128_A
  • TYPE_CODE_128_B
  • TYPE_CODE_128_C
  • TYPE_EAN_2
  • TYPE_EAN_5
  • TYPE_EAN_8
  • TYPE_EAN_13
  • TYPE_UPC_A
  • TYPE_UPC_E
  • TYPE_MSI
  • TYPE_MSI_CHECKSUM
  • TYPE_POSTNET
  • TYPE_PLANET
  • TYPE_RMS4CC
  • TYPE_KIX
  • TYPE_IMB
  • TYPE_CODABAR
  • TYPE_CODE_11
  • TYPE_PHARMA_CODE
  • TYPE_PHARMA_CODE_TWO_TRACKS

Testing

composer test

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

This package contains code copied from PHP Barcode Generator

License

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