All Projects → PicoPrime → Barcodegen

PicoPrime / Barcodegen

Licence: mit
Barcode Generator

Labels

Projects that are alternatives of or similar to Barcodegen

Laravel Spark Google2fa
Google Authenticator support for Laravel Spark
Stars: ✭ 86 (-3.37%)
Mutual labels:  laravel
Laravel Enum
Simple, extensible and powerful enumeration implementation for Laravel.
Stars: ✭ 1,278 (+1335.96%)
Mutual labels:  laravel
Laravel Id Generator
Easy way to generate custom ID from database table in Laravel framework.
Stars: ✭ 88 (-1.12%)
Mutual labels:  laravel
Laravel Woocommerce
WooCommerce Rest API for Laravel
Stars: ✭ 86 (-3.37%)
Mutual labels:  laravel
Laravel Facebook Ads
Facebook & Instagram Ads API for Laravel
Stars: ✭ 87 (-2.25%)
Mutual labels:  laravel
Trello Clone Vue Laravel
This is a Trello clone built using Laravel and Vue. You can read about how it was created in the series.
Stars: ✭ 88 (-1.12%)
Mutual labels:  laravel
Laravel Api Starter
laravel5.5 + dingo/api + JWT
Stars: ✭ 85 (-4.49%)
Mutual labels:  laravel
Artify
The Missing Laravel Commands
Stars: ✭ 89 (+0%)
Mutual labels:  laravel
Warehouse
Artesãos Warehouse - A simple and direct approach to repositories!
Stars: ✭ 87 (-2.25%)
Mutual labels:  laravel
Laravel Electron
Making Laravel desktop application using Electron Js
Stars: ✭ 89 (+0%)
Mutual labels:  laravel
Dompet
A personal bookkeeping web application, built with Laravel 5.
Stars: ✭ 87 (-2.25%)
Mutual labels:  laravel
Background Template For Laravel5
专门为Laravel5整理的后台模板,只写了路由的页面跳转,给开发者最大的空间自己开发.
Stars: ✭ 87 (-2.25%)
Mutual labels:  laravel
Lingo
A Gui To Manage Laravel Translation Files
Stars: ✭ 88 (-1.12%)
Mutual labels:  laravel
Zipcode
Zip code searcher
Stars: ✭ 86 (-3.37%)
Mutual labels:  laravel
Laravel Sync Migration
Developer tool helps to sync migrations without refreshing the database
Stars: ✭ 89 (+0%)
Mutual labels:  laravel
Laravel 5 Myblog
The php blog writed by laravel5.1
Stars: ✭ 86 (-3.37%)
Mutual labels:  laravel
Mqtt Laravel
A simple Laravel Library to connect/publish/subscribe to MQTT broker
Stars: ✭ 88 (-1.12%)
Mutual labels:  laravel
Blog System In Laravel
Complete Blog System in Laravel
Stars: ✭ 89 (+0%)
Mutual labels:  laravel
Laravel Package Maker
Get a 📦 skeleton and all other `make` commands from laravel base for package development.
Stars: ✭ 89 (+0%)
Mutual labels:  laravel
Laravel Nullable Fields
Handles saving empty fields as null for Eloquent models
Stars: ✭ 88 (-1.12%)
Mutual labels:  laravel

Barcode Generator

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

Installation

Through Composer, obviously:

composer require picoprime/barcodegen

or you can edit composer.json file and add "picoprime/barcodegen": "~1.5" to your "require" section.

Setup

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, to providers
  • 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:
$this->barcode
    ->init($text, $size, $orientation, $codeType, $scale)
    ->generate()

or with facade and direct generate call:

\PicoPrime\BarcodeGen\BarcodeGen::generate($text, $size, $orientation, $codeType, $scale)

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:

$this->barcode
    ->generate(compact('text', 'size', 'orientation', 'codeType', 'scale'))

or using facade:

\PicoPrime\BarcodeGen\BarcodeGen::generate(['textToTransform', 50, 'horizontal', 'code128', 1])

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:

Route::get('barcode/img/{text}/{size?}/{scale?}/{codeType?}/{orientation?}', '[email protected]');
Route::get('barcode/url/{text}/{size?}/{scale?}/{codeType?}/{orientation?}', '[email protected]');

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:

<img src="/barcode/img/someText" alt="barcode">

This example should generate horizontal, 50px, code128 barcode for "someText".

Issues

Please feel free to create an issue on GitHub if you come across any errors or if you have an idea for improvement.

Enjoy

Oh and if you've come down this far, you might as well follow me on twitter or check out my company's website.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].