Tinkerwell - The PHP Scratchpad

Barcode

milon/barcode image

Barcode stats

Downloads
6M
Stars
1,198
Open Issues
48
Forks
308

View on GitHub →

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

Laravel Barcode Package by Milon

Laravel Barcode is a comprehensive barcode generation package for Laravel, acting as a wrapper around the robust features provided by TCPDF. It simplifies the process of generating various types of barcodes within Laravel applications.

Key Features:

  • Supports a wide array of barcode formats including:
    • 1D Barcodes: C39, C93, EAN, UPC, and more.
    • 2D Barcodes: QR Code, PDF417, DataMatrix.
  • Output formats include SVG, HTML, and PNG.
  • Compatible with multiple Laravel versions (4.x to 10.x).
  • Requires the php-gd extension.

Installation:

  1. Install via Composer:

    composer require milon/barcode
  2. Register the Service Provider:

    • For Laravel 5.x and above:
      'providers' => [
      Milon\Barcode\BarcodeServiceProvider::class,
      ]
    • For Laravel 4.x:
      'providers' => array(
      'Milon\Barcode\BarcodeServiceProvider',
      )
  3. Add Aliases:

    'aliases' => [
    'DNS1D' => Milon\Barcode\Facades\DNS1DFacade::class,
    'DNS2D' => Milon\Barcode\Facades\DNS2DFacade::class,
    ]
  4. Publish Configuration:

    • Laravel 5.x:
      php artisan vendor:publish
    • Laravel 4.x:
      php artisan config:publish milon/barcode

Usage Examples:

  • Generate SVG Barcode:

    echo DNS1D::getBarcodeSVG('4445645656', 'C39');
  • Generate HTML Barcode:

    echo DNS1D::getBarcodeHTML('4445645656', 'C39');
  • Generate PNG Barcode:

    echo '<img src="data:image/png;base64,' . DNS1D::getBarcodePNG('4', 'C39+') . '" alt="barcode" />';

Additional Usage:

This package can be utilized outside Laravel by instantiating the barcode classes directly in any PHP script.

Conclusion:

Laravel Barcode is a versatile tool for any developer needing to implement barcode generation within their Laravel applications or even in plain PHP scripts. It provides a vast range of barcode types and formats, making it an essential package for e-commerce systems, inventory management, and more.

milon photo

Programmer, Author, Tech Enthusiast.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Milon Barcode Related Articles

Create Apple Wallet Passes in Laravel image

Create Apple Wallet Passes in Laravel

Read article
Laravel Scoped Route Binding for Nested Resource Management image

Laravel Scoped Route Binding for Nested Resource Management

Read article
Direct Printing for Laravel Apps image

Direct Printing for Laravel Apps

Read article
Open Food Facts API image

Open Food Facts API

Read article
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell