WARNING! THIS PROJECT IS NO LONGER MAINTAINED! WARNING!
Barcode Generator is a simple library that helps you create barcodes images.
It's designed for Laravel 5 and it can create PNG images or DATA-URL strings.
Based on great php-generator
by David Tufts
Through Composer, obviously:
composer require picoprime/barcodegen
or you can edit composer.json file and add "picoprime/barcodegen": "~1.5" to
your "require" section.
Successfully tested in Laravel 5. Steps to make it work:
edit "require" section in composer.json as described above
Ignore this step on Laravel 5.5 or newer - package will be auto discovered
edit config/app.php file and add PicoPrime\BarcodeGen\BarcodeGenServiceProvider::class,
create controller or add new methods to existing controllers (example is in "docs"
folder). You can use PicoPrime\BarcodeGen\BarcodeGenerator class directly or
PicoPrime\BarcodeGen\BarcodeGen facade. BarcodeGenerator can be injected as well.
Before you call generate() method you have to pass variables to init() like so:
Last step to generate image is to send whatever has been generated above
to ->response('png') or ->encode('data-url').
Response will create Laravel's response and will display an image, whilst
"encode" will create a string.
Please take a look at example controller in docs folder.
You can create routes as you like. Two examples that we usually use: