PHPackages                             glz/barcodegen - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. glz/barcodegen

ActiveLibrary[Image &amp; Media](/categories/media)

glz/barcodegen
==============

Generates barcodes images as PNG or DATA-URL

1.0.0(8y ago)0241MITPHPPHP &gt;=5.5.0

Since Aug 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/xurenlu/glz-barcodegen)[ Packagist](https://packagist.org/packages/glz/barcodegen)[ RSS](/packages/glz-barcodegen/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Barcode Generator
=================

[](#barcode-generator)

[![Author](https://camo.githubusercontent.com/fe82a7c2e80380a121ff03bdbd6554071cb9a52f6a4390e4fece711129c874c8/68747470733a2f2f7365637572652e67726176617461722e636f6d2f6176617461722f30373436313865333766363430643133643430323833306636313039326430393f643d6964656e7469636f6e26733d3530)](https://twitter.com/raffw7912)

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](https://github.com/davidscotttufts/php-barcode) by [David Tufts](https://github.com/davidscotttufts)

Installation
============

[](#installation)

Through Composer, obviously:

```
composer require picoprime/barcodegen:@dev

```

or you can edit composer.json file and add `"picoprime/barcodegen": "@dev"` to your "require" section.

Setup
=====

[](#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 call `generate()` method you have to pass variables to `init()` like so:

```
$this->barcode
    ->init($text, $size, $orientation, $codeType, $scale)
    ->generate()

```

or

```
$this->barcode
    ->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

```
$this->barcode
    ->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

[](#routes)

You can create routes as you like. Two examples that we usually use:

```
Route::get('barcode/img/{text}/{size?}/{scale?}/{codeType?}/{orientation?}', 'BarcodeController@barcodeAsPng');
Route::get('barcode/url/{text}/{size?}/{scale?}/{codeType?}/{orientation?}', 'BarcodeController@barcodeAsDataUrl');

```

Please take a look at example route in `docs` folder.

### Frontend use

[](#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
------

[](#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  instead of using the issue tracker.

Enjoy
=====

[](#enjoy)

Oh and if you've come down this far, you might as well follow me on [twitter](http://twitter.com/raffw7912)or check out our company's [website](https://picoprime.com).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3198d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cbeae1ee5ec80c5fb7c2fcbf1f06f9a6b62cfc4e51b8489ec3b765c8abb457c0?d=identicon)[huanggun](/maintainers/huanggun)

---

Tags

imagegeneratorbarcodesbarcodepnggeneratedata-urlprimepicopicoprime

### Embed Badge

![Health badge](/badges/glz-barcodegen/health.svg)

```
[![Health](https://phpackages.com/badges/glz-barcodegen/health.svg)](https://phpackages.com/packages/glz-barcodegen)
```

###  Alternatives

[picqer/php-barcode-generator

An easy to use, non-bloated, barcode generator in PHP. Creates SVG, PNG, JPG and HTML images from the most used 1D barcode standards.

1.8k25.5M88](/packages/picqer-php-barcode-generator)[yzalis/identicon

Generate unique identicon avatars from any string

5901.1M21](/packages/yzalis-identicon)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M102](/packages/intervention-image-laravel)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[multiavatar/multiavatar-php

Multicultural Avatar Generator

653150.0k4](/packages/multiavatar-multiavatar-php)[jkphl/iconizr

A PHP command line tool for converting SVG images to a set of CSS icons (SVG &amp; PNG, single icons and / or CSS sprites) with support for image optimization and Sass output

4869.0k](/packages/jkphl-iconizr)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
