PHPackages                             dscmall/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. dscmall/barcodegen

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

dscmall/barcodegen
==================

Generates barcodes images as PNG or DATA-URL

v1.5.0(5y ago)02.7k↓50%MITPHPPHP &gt;=5.5.0

Since Dec 31Pushed 5y ago1 watchersCompare

[ Source](https://github.com/dscmall/barcodegen)[ Packagist](https://packagist.org/packages/dscmall/barcodegen)[ RSS](/packages/dscmall-barcodegen/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

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

[](#barcode-generator)

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

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 dscmall/barcodegen

```

or you can edit composer.json file and add `"dscmall/barcodegen": "~1.0"` 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
- **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

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

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

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

Enjoy
=====

[](#enjoy)

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

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

1965d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/14adbbf91a457fe02616d39410c9024975328c73ed344881a8d800ce5b5e1953?d=identicon)[ectouch](/maintainers/ectouch)

---

Top Contributors

[![comdevsource](https://avatars.githubusercontent.com/u/39083797?v=4)](https://github.com/comdevsource "comdevsource (1 commits)")

---

Tags

imagegeneratorbarcodesbarcodepnggeneratedata-urlprimepicopicoprime

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/dscmall-barcodegen/health.svg)](https://phpackages.com/packages/dscmall-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

1536.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)
