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

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

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.

v3.2.4(5mo ago)1.8k27.4M↓15.9%405[4 issues](https://github.com/picqer/php-barcode-generator/issues)[2 PRs](https://github.com/picqer/php-barcode-generator/pulls)20LGPL-3.0-or-laterPHPPHP ^8.2CI failing

Since Aug 13Pushed 5mo ago63 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (28)Used By (20)

PHP Barcode Generator
=====================

[](#php-barcode-generator)

[![Build Status](https://github.com/picqer/php-barcode-generator/workflows/phpunit/badge.svg)](https://github.com/picqer/php-barcode-generator/actions)[![Total Downloads](https://camo.githubusercontent.com/3450af50c8d751b267c449502a2db8332f8467561e5b06af596f0fbab6b0f7cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7069637165722f7068702d626172636f64652d67656e657261746f72)](https://packagist.org/packages/picqer/php-barcode-generator)[![Latest Stable Version](https://camo.githubusercontent.com/e5f516a6f6b385c32fbf32aa8996efe0b2d14b7a3cc65b4b38e93d735919ae48/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7069637165722f7068702d626172636f64652d67656e657261746f72)](https://packagist.org/packages/picqer/php-barcode-generator)

This is an easy to use, non-bloated, framework independent, barcode generator in PHP. It uses zero(!) composer dependencies and is only a handful of files. Probably the reason that this is the most downloaded barcode generator for PHP on Packagist. ;)

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

No support for...
-----------------

[](#no-support-for)

- No support for any **2D** barcodes, like QR codes.
- We only generate the 'bars' part of a barcode, without text below the barcode. If you want text of the code below the barcode, you could add it later to the output of this package.

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

[](#installation)

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

```
composer require picqer/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. For SVG or HTML renders, there are no dependencies.

Usage
-----

[](#usage)

You want a barcode for a specific "type" (for example Code 128 or UPC) in a specific image format (for example PNG or SVG).

- First, encode the string you want the barcode of into a `Barcode` object with one of the barcode types.
- Then, use one of the renderers to render the image of the bars in the `Barcode` object.

> The "type" is a standard that defines which characters you can encode and which bars represent which character. The most used types are [code 128](https://en.wikipedia.org/wiki/Code_128) and [EAN/UPC](https://en.wikipedia.org/wiki/International_Article_Number). Not all characters can be encoded into each barcode type, and not all barcode scanners can read all types.

```
