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

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

jorgenwdm/laravel-barcode
=========================

A Laravel barcode generator based on TCPDF barcode library

156.1k↓49.3%[1 issues](https://github.com/jorgenwdm/laravel-barcode/issues)PHP

Since Nov 24Pushed 4y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

[![Laravel Barcode Logo](art/github-banner.jpg)](art/github-banner.jpg)

 [Requirements](#requirements) | [Installation](#installation) | [Supported Symbologies](#supported-symbologies)

---

Laravel Barcode
===============

[](#laravel-barcode)

Introduction
------------

[](#introduction)

Laravel Barcode is a wrapper for the TCPDF barcode functions and was built exclusively for the [Laravel](https://laravel.com) platform. This project supports 31 symbologies for 1D barcodes and 3 symbologies for 2D barcodes

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- Laravel &gt;= 8.6.6

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

[](#installation)

Installation is pretty easy.

First you install the package

```
composer require jorgenwdm/laravel-barcode
```

Then you can publish the configuration file of this package (at the moment this is empty).

```
php artisan vendor:publish --provider="Jorgenwdm\Barcode\BarcodeServiceProvider"
```

Note: Our configuration file is `laravel-barcode.php` and you will find it in your Laravel `config` folder.

And we are ready to go!

Some important notes
--------------------

[](#some-important-notes)

Every barcode 1D or 2D consists of elements. 1D barcode consists of lines and 2D barcode of rectangles. When we set the size of a barcode, we set the size of each element (not the size of the whole barcode).

Also, when we set the color, this is the color for each element of the barcode. The background of the barcode is always transparent.

Supported Symbologies
---------------------

[](#supported-symbologies)

CategoryTypeDescription1DC39CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.1DC39+CODE 39 with checksum1DC39ECODE 39 EXTENDED1DC39E+CODE 39 EXTENDED + CHECKSUM1DC93CODE 93 - USS-931DS25Standard 2 of 51DS25+Standard 2 of 5 + CHECKSUM1DI25Interleaved 2 of 51DI25+Interleaved 2 of 5 + CHECKSUM1DC128CODE 1281DC128ACODE 128 A1DC128BCODE 128 B1DC128CCODE 128 C1DEAN22-Digits UPC-Based Extension1DEAN55-Digits UPC-Based Extension1DEAN8EAN 81DEAN13EAN 131DUPCAUPC-A1DUPCEUPC-E1DMSIMSI (Variation of Plessey code)1DMSI+MSI + CHECKSUM (modulo 11)1DPOSTNETPOSTNET1DPLANETPLANET1DRMS4CCRMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)1DKIXKIX (Klant index - Customer index)1DIMBIMB - Intelligent Mail Barcode - Onecode - USPS-B-32001DIMBPREIMB - Intelligent Mail Barcode - Onecode - USPS-B-3200- pre-processed1DCODABARCODABAR1DCODE11CODE 111DPHARMAPHARMACODE1DPHARMA2TPHARMACODE TWO-TRACKS2DDATAMATRIXDataMatrix ECC 2002DQRCODEQR Code2DPDF147PDF417 (ISO/IEC 15438:2006)How to create a 1D barcode
--------------------------

[](#how-to-create-a-1d-barcode)

The way to create a barcode with the default settings is very simple.

There are four output methods supported: `toHtml()`, `toSvgCode()`, `toPng()`, `toSvg()`.

Examples:

```
    use Jorgenwdm\Barcode\Generators\Barcode1d;

    echo Barcode1d::create("C39", "12345678")->toHtml();
```

```
    use Jorgenwdm\Barcode\Generators\Barcode1d;

    echo "";
    echo Barcode1d::create("C39", "12345678")->toSvgCode();
    echo "";
```

```
    use Jorgenwdm\Barcode\Generators\Barcode1d;

    $content = Barcode1d::create("C39", "12345678")->toPng();

    return response($content)->header('Content-Type', 'image/png');
```

```
    use Jorgenwdm\Barcode\Generators\Barcode1d;

    $content = Barcode1d::create("C39", "12345678")->toSvg();

    return response($content)->header('Content-Type', 'image/svg+xml');
```

Additionally there are helping methods to customize the final barcode to be rendered.

These are `size($width, $height)`, `color($hexColor)`.

```
    use Jorgenwdm\Barcode\Generators\Barcode1d;

    // We will create a C39 barcode where each line width is 2px and height is 30px
    // The color of the barcode will be #000000 (that is black)
    echo Barcode1d::create("C39", "12345678")->size(2,30)->color("#000000")->toHtml();
```

How to create a 2D barcode
--------------------------

[](#how-to-create-a-2d-barcode)

The way to create a barcode with the default settings is very simple.

There are four output methods supported: `toHtml()`, `toSvgCode()`, `toPng()`, `toSvg()`.

Examples:

```
    use Jorgenwdm\Barcode\Generators\Barcode2d;

    echo Barcode2d::create("DATAMATRIX", "http://www.test.com/")->toHtml();
```

```
    use Jorgenwdm\Barcode\Generators\Barcode2d;

    echo "";
    echo Barcode2d::create("QRCODE", "http://www.test.com/")->toSvgCode();
    echo "";
```

```
    use Jorgenwdm\Barcode\Generators\Barcode2d;

    $content = Barcode2d::create("DATAMATRIX", "http://www.test.com/")->toPng();

    return response($content)->header('Content-Type', 'image/png');
```

```
    use Jorgenwdm\Barcode\Generators\Barcode2d;

    $content = Barcode2d::create("QRCODE", "http://www.test.com/")->toSvg();

    return response($content)->header('Content-Type', 'image/svg+xml');
```

Additionally there are helping methods to customize the final barcode to be rendered.

These are `size($width, $height)`, `color($hexColor)`.

```
    use Jorgenwdm\Barcode\Generators\Barcode2d;

    // We will create a DATAMATRIX barcode where
    // each small rectangle of the barcode has width 6px and height 6px
    // The color of the barcode will be #000000 (that is black)
    echo Barcode2d::create("DATAMATRIX", "http://www.in.gr/")->size(6,6)->color("#000000")->toHtml();
```

Helper function
---------------

[](#helper-function)

We have also created a helper function that wraps all the basic functionalities of the barcode generators. This function is auto-loaded as soon as you install this package and you can use it globally in your project.

Tha basic syntax is

```
create_barcode($barcodeCategory, $barcodeType, $barcodeText, $width, $height, $hexColor, $output);
```

ArgumentDescriptionValues$barcodeCategoryThe category of the barcode1D, 2D$barcodeTypeThe type of the barcodeC39, C39+, ...$barcodeTextThe text for the barcode\[string\]$widthThe width of each element that the barcode consists of\[integer\]$heightThe height of each element that the barcode consists of\[integer\]$hexColorThe color of each element that the barcode consists of\[string hex color\]$outputThe output format of the barcodeHTML, SVG, PNG, SVGCODEExample:

```
    echo create_barcode("1D", "C39", "GEORGE", 5, 30, "#000000", "HTML");
```

License
-------

[](#license)

This project is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12896726?v=4)[jorgenwdm](/maintainers/jorgenwdm)[@jorgenwdm](https://github.com/jorgenwdm)

---

Top Contributors

[![jorgenwdm](https://avatars.githubusercontent.com/u/12896726?v=4)](https://github.com/jorgenwdm "jorgenwdm (2 commits)")

### Embed Badge

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

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

###  Alternatives

[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)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

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