PHPackages                             druidvav/php-barcode-generator - 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. druidvav/php-barcode-generator

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

druidvav/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.

v0.4.1(8y ago)028.7k↓100%LGPLv3PHPPHP &gt;=5.4.0

Since Aug 13Pushed 7y ago2 watchersCompare

[ Source](https://github.com/druidvav/php-barcode-generator)[ Packagist](https://packagist.org/packages/druidvav/php-barcode-generator)[ Docs](http://github.com/picqer/php-barcode-generator)[ RSS](/packages/druidvav-php-barcode-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (8)Used By (0)

PHP Barcode Generator [![Build Status](https://camo.githubusercontent.com/d1d75efe07313ca7dca2005b482392f90d5cb8e31aacff68f87f35d0de3ade81/68747470733a2f2f7472617669732d63692e6f72672f7069637165722f7068702d626172636f64652d67656e657261746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/picqer/php-barcode-generator) [![Total Downloads](https://camo.githubusercontent.com/de932465e39d40e2fc2681bab7d0f2caab78264e7672e333bdc461cd377f4b11/68747470733a2f2f706f7365722e707567782e6f72672f7069637165722f7068702d626172636f64652d67656e657261746f722f646f776e6c6f616473)](https://packagist.org/packages/picqer/php-barcode-generator)
===========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#php-barcode-generator--)

This is an easy to use, non-bloated, framework independent, barcode generator in PHP.

It creates SVG, PNG, JPG and HTML images, from the most used 1D barcode standards.

*The codebase is largely from the [TCPDF barcode generator](https://github.com/tecnickcom/TCPDF) by Nicola Asuni. This code is therefor licensed under LGPLv3. It is still a bit of a mess, bit I will clean it in the future. I do not expect the interface of this class will change during the clean ups.*

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

[](#installation)

Install through [composer](https://getcomposer.org/doc/00-intro.md):

```
composer require druidvav/php-barcode-generator

```

If you want to generate PNG or JPG images, you need the GD library or Imagick installed on your system as well.

Usage
-----

[](#usage)

Initiate the barcode generator for the output you want, then call the -&gt;getBarcode() routine as many times as you want.

```
$generator = new Picqer\Barcode\BarcodeGeneratorHTML();
echo $generator->getBarcode('081231723897', $generator::TYPE_CODE_128);
```

The -&gt;getBarcode() routine accepts the following:

- $code Data for the barcode
- $type Type of barcode, use the constants defined in the class
- $widthFactor Width is based on the length of the data, with this factor you can make the barcode bars wider than default
- $totalHeight The total height of the barcode
- $color Hex code of the foreground color

Image types
-----------

[](#image-types)

```
$generatorSVG = new Picqer\Barcode\BarcodeGeneratorSVG();
$generatorPNG = new Picqer\Barcode\BarcodeGeneratorPNG();
$generatorJPG = new Picqer\Barcode\BarcodeGeneratorJPG();
$generatorHTML = new Picqer\Barcode\BarcodeGeneratorHTML();
```

Accepted types
--------------

[](#accepted-types)

- TYPE\_CODE\_39
- TYPE\_CODE\_39\_CHECKSUM
- TYPE\_CODE\_39E
- TYPE\_CODE\_39E\_CHECKSUM
- TYPE\_CODE\_93
- TYPE\_STANDARD\_2\_5
- TYPE\_STANDARD\_2\_5\_CHECKSUM
- TYPE\_INTERLEAVED\_2\_5
- TYPE\_INTERLEAVED\_2\_5\_CHECKSUM
- TYPE\_CODE\_128
- TYPE\_CODE\_128\_A
- TYPE\_CODE\_128\_B
- TYPE\_CODE\_128\_C
- TYPE\_EAN\_2
- TYPE\_EAN\_5
- TYPE\_EAN\_8
- TYPE\_EAN\_13
- TYPE\_UPC\_A
- TYPE\_UPC\_E
- TYPE\_MSI
- TYPE\_MSI\_CHECKSUM
- TYPE\_POSTNET
- TYPE\_PLANET
- TYPE\_RMS4CC
- TYPE\_KIX
- TYPE\_IMB
- TYPE\_CODABAR
- TYPE\_CODE\_11
- TYPE\_PHARMA\_CODE
- TYPE\_PHARMA\_CODE\_TWO\_TRACKS

Examples
--------

[](#examples)

Embedded PNG image in HTML:

```
$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
echo '';
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.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 ~146 days

Total

7

Last Release

3042d ago

### Community

Maintainers

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

---

Top Contributors

[![casperbakker](https://avatars.githubusercontent.com/u/886975?v=4)](https://github.com/casperbakker "casperbakker (22 commits)")[![druidvav](https://avatars.githubusercontent.com/u/1116122?v=4)](https://github.com/druidvav "druidvav (8 commits)")[![curtisgibby](https://avatars.githubusercontent.com/u/1086964?v=4)](https://github.com/curtisgibby "curtisgibby (1 commits)")[![frankirox](https://avatars.githubusercontent.com/u/1335554?v=4)](https://github.com/frankirox "frankirox (1 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (1 commits)")[![amenk](https://avatars.githubusercontent.com/u/1087128?v=4)](https://github.com/amenk "amenk (1 commits)")[![stephangroen](https://avatars.githubusercontent.com/u/1607643?v=4)](https://github.com/stephangroen "stephangroen (1 commits)")[![binarix](https://avatars.githubusercontent.com/u/4037156?v=4)](https://github.com/binarix "binarix (1 commits)")

---

Tags

phphtmlsvgbarcodepngEAN13jpegeanbarcode generatorCODABARupcjpgPharmacode39Standard 2 of 5MSIPOSTNETKIXcode128Code93KIXCODECode11

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/druidvav-php-barcode-generator/health.svg)

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

###  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.5M85](/packages/picqer-php-barcode-generator)[tecnickcom/tc-lib-barcode

PHP library to generate linear and bidimensional barcodes

2957.1M28](/packages/tecnickcom-tc-lib-barcode)[barcode-bakery/barcode-1d

Generates 1D barcodes from a PHP server to a file or HTML document.

10146.1k1](/packages/barcode-bakery-barcode-1d)[choowx/rasterize-svg

A PHP library for converting SVG to JPEG, PNG, and WEBP

2261.7k](/packages/choowx-rasterize-svg)

PHPackages © 2026

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