Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Barcode Laravel Package

milon/barcode

Generate and embed barcodes in Laravel with milon/barcode. It supports 20+ symbologies including Code 128, EAN-13, UPC-A, MSI, and POSTNET, and renders to HTML, PNG, JPG, SVG, or PDF through a simple facade and Blade-friendly API.

View on GitHub
Deep Wiki
Context7

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)

Frequently asked questions about Barcode
What barcode formats does milon/barcode support in Laravel?
The package covers linear symbologies including C39, C39+, C39E, C93, S25, I25, C128 (A/B/C), EAN-8, EAN-13, UPC-A, UPC-E, MSI and the 2-digit and 5-digit UPC extensions. Matrix codes such as QR Code and PDF417 are also supported through the DNS2D facade. Coverage spans typical retail, logistics, ticketing and asset-tagging needs without pulling in extra dependencies.
How do I install milon/barcode with Composer?
Run composer require milon/barcode and the package auto-discovers its service provider on Laravel 5.5 and later. You can optionally publish the configuration with php artisan vendor:publish to get a config/barcode.php file you can customise. No migrations or database tables are involved, so installation is limited to the single Composer require plus an optional config publish.
Which Laravel and PHP versions are supported by milon/barcode?
The package tracks Laravel major releases and has received compatibility bumps across versions, with recent releases adding PHP 8.6 test coverage. Because the wrapper stays thin around the TCPDF barcode engine, upgrading Laravel usually requires only a version bump in composer.json. Check the release notes for the exact constraint on your Laravel and PHP combination before upgrading.
How do I render a barcode in a Blade view with milon/barcode?
Call the facade inside the template, for example DNS1D::getBarcodeHTML('4445645656', 'C128') for inline HTML, or DNS1D::getBarcodePNG('4445645656', 'C128') to get raw PNG bytes. The HTML variant drops straight into a Blade view while the PNG variant usually belongs in a controller that returns a response with the correct image content type. Both calls are stateless statics, so they work in controllers, jobs and Artisan commands too.
Does milon/barcode require the GD extension?
Yes. Rendering happens in-process through the bundled barcode engine, so ext-gd must be installed in every environment that generates images, including local, CI, staging and production containers. Because generation consumes CPU and memory on whichever worker invokes it, bulk label runs are better offloaded to a queue or a dedicated render service. Pin ext-gd in your base image and confirm any customer-hosted deployments include it as well.
Is milon/barcode safe to use with user-supplied barcode data?
Most symbologies do not validate content by default, so length rules and check digits are the caller's responsibility, with GS1-128 validation only added recently. The HTML output from getBarcodeHTML() can be HTML-injectable if payloads contain user data, so validate and restrict input or use the PNG path instead. Large dimension or high-density requests are also a cheap CPU and memory amplification vector worth rate limiting.
What licence does milon/barcode use, and can I use it in a commercial product?
Package metadata reports NOASSERTION while the underlying TCPDF-derived barcode classes are widely understood to be LGPL-3.0, so the licence situation is ambiguous. LGPL is generally workable in PHP because there is no static linking, but that is a legal position rather than an engineering guarantee. Get counsel to confirm obligations for your distribution model, whether SaaS-only, on-premise or embedded, before shipping.
How do I test barcode generation in a Laravel test suite?
Since the facades are stateless statics returning image bytes or HTML, you can assert on output length, PNG magic bytes or the presence of a data URI in the returned string. If you prefer full isolation, swap the facade with Facade::fake() or bind a stub implementation in the container. Avoid asserting on exact pixel output, which changes with GD versions.
Is milon/barcode actively maintained and what is the bus factor?
The project is alive, with recent releases adding GS1-128 validation and PHP 8.6 test coverage, and roughly 1.5k stars on GitHub. Recent work is concentrated among a small number of contributors, mostly compatibility bumps, and there is no commercial backer. Treat it as a one-to-two-person effort and plan for the possibility of pinning a version or forking if patches are needed.
What are good alternatives to milon/barcode for generating barcodes in Laravel?
The most direct alternatives are the underlying tecnickcom/tcpdf barcode classes, picqer/php-barcode-generator for linear formats, and endroid/qr-code or simplesoftwareio/simple-qrcode for QR. Choosing a pure-PHP library with a clear MIT licence may be preferable if LGPL obligations are a concern. milon/barcode remains the most convenient option when you want both linear and 2D codes behind a single Laravel facade.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
roundly-consulting/kubernetes-api-for-laravel
roundly-consulting/plausible-for-laravel
gvp/gvp-laravel-template
metasyncsite/laravel-metasync-client
roundly-consulting/onboarding-for-laravel
andydefer/laravel-notification
adachsoft/cli-process-tester
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo