PHPackages                             milon/barcode - 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. milon/barcode

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

milon/barcode
=============

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

v13.1(2mo ago)1.5k13.3M—4.1%328[53 issues](https://github.com/milon/barcode/issues)20LGPL-3.0PHPPHP ^7.3 | ^8.0CI passing

Since Feb 22Pushed 2mo ago36 watchersCompare

[ Source](https://github.com/milon/barcode)[ Packagist](https://packagist.org/packages/milon/barcode)[ Fund](https://paypal.me/nuruzzamanmilon)[ GitHub Sponsors](https://github.com/milon)[ RSS](/packages/milon-barcode/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (47)Used By (20)

[![Packagist Downloads](https://camo.githubusercontent.com/380ee6ca65b291cc80c8d75844fd2fb5418b1caf544542a7cda870a4528fa2ab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696c6f6e2f626172636f64652e737667)](https://packagist.org/packages/milon/barcode)[![Stable version](https://camo.githubusercontent.com/b723907232ce465c2b1f9b3f647b9870c11b47c54dbc170cfeb95eaa0a311e63/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696c6f6e2f626172636f64652e737667)](https://packagist.org/packages/milon/barcode)[![License](https://camo.githubusercontent.com/324fa92153a5afb935c7ec4c28ec9e04abda1c484ccd472be9feff044613e069/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d696c6f6e2f626172636f64652e737667)](https://packagist.org/packages/milon/barcode)

[![Banner](./banner.png)](./banner.png)

This is a barcode generation package inspired by . Actually, I use that package's underline classes for generating barcodes. This package is just a wrapper of that package and adds compatibility with Laravel.

I used the following classes of that package.

- src/Milon/Barcode/Datamatrix.php (include/barcodes/datamatrix.php)
- src/Milon/Barcode/DNS1D.php (tcpdf\_barcodes\_1d.php)
- src/Milon/Barcode/DNS2D.php (tcpdf\_barcodes\_2d.php)
- src/Milon/Barcode/PDF417.php (include/barcodes/pdf417.php)
- src/Milon/Barcode/QRcode.php (include/barcodes/qrcode.php)

[Read More on TCPDF website](http://www.tcpdf.org)

This package relies on [php-gd](http://php.net/manual/en/book.image.php) extension. So, make sure it is installed on your machine.

Installation
------------

[](#installation)

Begin by installing this package through Composer. Just run following command to terminal-

```
composer require milon/barcode
```

You can also edit your project's `composer.json` file to require `milon/barcode`. Just make sure you choosed the compatible version of the package from the following table.

Compatibility
-------------

[](#compatibility)

Laravel VersionBarcode Package Version13.\*^13.012.\*^12.011.\*^11.010.\*^10.09.\*^9.08.\*^8.07.\*^7.06.\*^6.05.0 and 5.1^5.14.0, 4.1, 4.2^4.2Configuration
-------------

[](#configuration)

> If you are using version 6 or above, then the Service Provider and aliases will be published automatically. For prior versions, please follow the below instruction.

After updating Composer, add the service provider to your `config/app.php` file:

```
'providers' => [
    // ...
    Milon\Barcode\BarcodeServiceProvider::class,
]
```

For Laravel version 4.\*, add the following lines to your `app/config/app.php` file:

```
'providers' => array(
    // ...
    'Milon\Barcode\BarcodeServiceProvider',
)
```

**Make sure you have write permission to the storage path. By default it sets to `/storage` folder.**

```
'aliases' => [
    // ...
    'DNS1D' => Milon\Barcode\Facades\DNS1DFacade::class,
    'DNS2D' => Milon\Barcode\Facades\DNS2DFacade::class,
]
```

For version 4.2 alias will be like this-

```
'aliases' => array(
    // ...
    'DNS1D' => 'Milon\Barcode\Facades\DNS1DFacade',
    'DNS2D' => 'Milon\Barcode\Facades\DNS2DFacade',
)
```

Publishing Configuration
------------------------

[](#publishing-configuration)

To customize the barcode settings (e.g., store path), publish the configuration file(s) by running the appropriate command in the terminal:

```
# Laravel 5.x
php artisan vendor:publish

# Laravel 4.x
php artisan config:publish milon/barcode
```

Usage
-----

[](#usage)

Bar-code generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

generator in html, png , jpeg embedded base64 code and SVG canvas

```
echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T');
echo '';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T');
echo '';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T');
echo '';
```

```
echo DNS1D::getBarcodeSVG('4445645656', 'C39');
echo DNS2D::getBarcodeHTML('4445645656', 'QRCODE');
echo DNS2D::getBarcodePNGPath('4445645656', 'PDF417');
echo DNS2D::getBarcodeSVG('4445645656', 'DATAMATRIX');
echo '';
```

Width and Height example
------------------------

[](#width-and-height-example)

```
echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T',3,33);
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T',3,33);
echo '';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T',3,33);
echo '';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T',3,33);
echo '';
```

Color
-----

[](#color)

```
echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T',3,33,'green');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T',3,33,'green');
echo '';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0));
echo '';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0));
echo '';
```

Show Text
---------

[](#show-text)

```
echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T',3,33,'green', true);
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T',3,33,'green', true);
echo '';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0), true);
echo '';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0), true);
echo '';
```

2D Barcodes
-----------

[](#2d-barcodes)

```
echo DNS2D::getBarcodeHTML('4445645656', 'QRCODE');
echo DNS2D::getBarcodePNGPath('4445645656', 'PDF417');
echo DNS2D::getBarcodeSVG('4445645656', 'DATAMATRIX');
```

1D Barcodes
-----------

[](#1d-barcodes)

```
echo DNS1D::getBarcodeHTML('4445645656', 'C39');
echo DNS1D::getBarcodeHTML('4445645656', 'C39+');
echo DNS1D::getBarcodeHTML('4445645656', 'C39E');
echo DNS1D::getBarcodeHTML('4445645656', 'C39E+');
echo DNS1D::getBarcodeHTML('4445645656', 'C93');
echo DNS1D::getBarcodeHTML('4445645656', 'S25');
echo DNS1D::getBarcodeHTML('4445645656', 'S25+');
echo DNS1D::getBarcodeHTML('4445645656', 'I25');
echo DNS1D::getBarcodeHTML('4445645656', 'I25+');
echo DNS1D::getBarcodeHTML('4445645656', 'C128');
echo DNS1D::getBarcodeHTML('4445645656', 'C128A');
echo DNS1D::getBarcodeHTML('4445645656', 'C128B');
echo DNS1D::getBarcodeHTML('4445645656', 'C128C');
echo DNS1D::getBarcodeHTML('4445645656', 'GS1-128');
echo DNS1D::getBarcodeHTML('44455656', 'EAN2');
echo DNS1D::getBarcodeHTML('4445656', 'EAN5');
echo DNS1D::getBarcodeHTML('4445', 'EAN8');
echo DNS1D::getBarcodeHTML('4445', 'EAN13');
echo DNS1D::getBarcodeHTML('4445645656', 'UPCA');
echo DNS1D::getBarcodeHTML('4445645656', 'UPCE');
echo DNS1D::getBarcodeHTML('4445645656', 'MSI');
echo DNS1D::getBarcodeHTML('4445645656', 'MSI+');
echo DNS1D::getBarcodeHTML('4445645656', 'POSTNET');
echo DNS1D::getBarcodeHTML('4445645656', 'PLANET');
echo DNS1D::getBarcodeHTML('4445645656', 'RMS4CC');
echo DNS1D::getBarcodeHTML('4445645656', 'KIX');
echo DNS1D::getBarcodeHTML('4445645656', 'IMB');
echo DNS1D::getBarcodeHTML('4445645656', 'CODABAR');
echo DNS1D::getBarcodeHTML('4445645656', 'CODE11');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T');
```

Running without Laravel
=======================

[](#running-without-laravel)

You can use this library without using Laravel.

Example:

```
use \Milon\Barcode\DNS1D;

$d = new DNS1D();
$d->setStorPath(__DIR__.'/cache/');
echo $d->getBarcodeHTML('9780691147727', 'EAN13');
```

License
-------

[](#license)

This package is published under `GNU LGPLv3` license and copyright to [Nuruzzaman Milon](http://milon.im). Original Barcode generation classes were written by Nicola Asuni. The license agreement is on project's root.

### [Buy me a coffee ☕](https://paypal.me/tomilon?locale.x=en_US)

[](#buy-me-a-coffee-)

License: GNU LGPLv3
Package Author: [Nuruzzaman Milon](http://milon.im)
Original Barcode Class Author: [Nicola Asuni](http://www.tcpdf.org)
Package Copyright: Nuruzzaman Milon
Barcode Generation Class Copyright:
Nicola Asuni
Tecnick.com LTD
[www.tecnick.com](http://www.tecnick.com)

###  Health Score

74

—

ExcellentBetter than 100% of packages

Maintenance82

Actively maintained with recent releases

Popularity74

Solid adoption and visibility

Community47

Growing community involvement

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 67.1% 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

Every ~95 days

Recently: every ~103 days

Total

43

Last Release

84d ago

Major Versions

8.0.1 → 9.0.02022-02-15

9.0.1 → 10.0.02023-01-31

v10.0.1 → v11.0.02024-02-28

v11.0.1 → v12.0.02025-02-24

v12.1.0 → v13.02026-02-24

PHP version history (5 changes)0.5PHP &gt;=5.4.0

4.2PHP &gt;=5.3.0

5.3.6PHP &gt;=5.6.0

8.0.0PHP ^7.3

8.0.1PHP ^7.3 | ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/00e844b80719a8c2ed1a3c19a2caac697fdd5443d4109d8388fc75482054f8a1?d=identicon)[milon](/maintainers/milon)

---

Top Contributors

[![milon](https://avatars.githubusercontent.com/u/1138769?v=4)](https://github.com/milon "milon (100 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (5 commits)")[![erikn69](https://avatars.githubusercontent.com/u/4933954?v=4)](https://github.com/erikn69 "erikn69 (4 commits)")[![rudashi](https://avatars.githubusercontent.com/u/5038647?v=4)](https://github.com/rudashi "rudashi (3 commits)")[![dhanar98](https://avatars.githubusercontent.com/u/76101113?v=4)](https://github.com/dhanar98 "dhanar98 (3 commits)")[![maosalah](https://avatars.githubusercontent.com/u/2687734?v=4)](https://github.com/maosalah "maosalah (3 commits)")[![Ank91](https://avatars.githubusercontent.com/u/98448051?v=4)](https://github.com/Ank91 "Ank91 (2 commits)")[![SanderWind](https://avatars.githubusercontent.com/u/1670379?v=4)](https://github.com/SanderWind "SanderWind (2 commits)")[![laszlokis-lynx](https://avatars.githubusercontent.com/u/258006090?v=4)](https://github.com/laszlokis-lynx "laszlokis-lynx (2 commits)")[![mix5003](https://avatars.githubusercontent.com/u/1129524?v=4)](https://github.com/mix5003 "mix5003 (2 commits)")[![squatto](https://avatars.githubusercontent.com/u/748444?v=4)](https://github.com/squatto "squatto (2 commits)")[![yoshkin](https://avatars.githubusercontent.com/u/4170784?v=4)](https://github.com/yoshkin "yoshkin (2 commits)")[![junereycasuga](https://avatars.githubusercontent.com/u/1797584?v=4)](https://github.com/junereycasuga "junereycasuga (2 commits)")[![RobLui](https://avatars.githubusercontent.com/u/10846766?v=4)](https://github.com/RobLui "RobLui (1 commits)")[![sorelio](https://avatars.githubusercontent.com/u/75777120?v=4)](https://github.com/sorelio "sorelio (1 commits)")[![spidfire](https://avatars.githubusercontent.com/u/156694?v=4)](https://github.com/spidfire "spidfire (1 commits)")[![tcardwell-CK](https://avatars.githubusercontent.com/u/113467456?v=4)](https://github.com/tcardwell-CK "tcardwell-CK (1 commits)")[![manticorp](https://avatars.githubusercontent.com/u/3750419?v=4)](https://github.com/manticorp "manticorp (1 commits)")[![crishoj](https://avatars.githubusercontent.com/u/20393?v=4)](https://github.com/crishoj "crishoj (1 commits)")[![cyberhicham](https://avatars.githubusercontent.com/u/10002527?v=4)](https://github.com/cyberhicham "cyberhicham (1 commits)")

---

Tags

barcodebarcode-generatorlaravelqr codeqrcodelaraveldatamatrixpdf417barcodeeanCODABARCODE 39CODE 128

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/milon-barcode/health.svg)

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

###  Alternatives

[tecnickcom/tc-lib-barcode

PHP library to generate linear and bidimensional barcodes

2957.1M28](/packages/tecnickcom-tc-lib-barcode)[jucksearm/php-barcode

Barcode Generation Package inspired by Nicola Asuni.

12362.6k1](/packages/jucksearm-php-barcode)

PHPackages © 2026

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