Download the PHP package glz/barcodegen without Composer
On this page you can find all versions of the php package glz/barcodegen. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package barcodegen
Barcode Generator
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
Installation
Through Composer, obviously:
or you can edit composer.json file and add "picoprime/barcodegen": "@dev"
to your "require" section.
Setup
Successfully tested in Laravel 5. Steps to make it work:
- edit "require" section in composer.json as described above
- edit config/app.php file and add
PicoPrime\BarcodeGen\BarcodeGenServiceProvider::class,
to providers - create controller or add new methods to existing controllers (example is in "docs" folder).
You have to use
PicoPrime\BarcodeGen\BarcodeGenerator
in your controllers. It can be injected as well. Before you callgenerate()
method you have to pass variables toinit()
like so:
or
where:
- "text" is the text that you want to transform into barcode,
- "size" is barcode's height in pixels. If you need to change width as well then use "scale" together with "size"!
- "orientation" does what it says - changes barcode's orientation. Available: horizontal and vertical,
- "codeType" is the type of code that you want to generate. Available: code128, code128a, code39, code25, codabar.
- "scale" - if you need wider or just bigger barcode enter a number: 1 - default, 2 - 2x bigger, 2.5, ...
You can also pass these parameters as assoc or numeric array, like so:
or
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.
Routes
You can create routes as you like. Two examples that we usually use:
Please take a look at example route in docs
folder.
Frontend use
Finally to use it in frontend, just use your route in img
"src" attribute:
This example should generate horizontal, 50px, code128 barcode for "someText".
Issues
We are still in development, so be aware of little bugs that may slip through our fingers. If you discover any issues, please email [email protected] instead of using the issue tracker.
Enjoy
Oh and if you've come down this far, you might as well follow me on twitter or check out our company's website.