PHPackages                             hkvstore/tc-lib-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. hkvstore/tc-lib-barcode

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hkvstore/tc-lib-barcode
=======================

PHP library to generate linear and bidimensional barcodes

v1.17.14(3y ago)02.0kLGPL-3.0PHPPHP &gt;=7.4

Since Sep 8Pushed 3y agoCompare

[ Source](https://github.com/hkvstore/tc-lib-barcode)[ Packagist](https://packagist.org/packages/hkvstore/tc-lib-barcode)[ Docs](http://www.tecnick.com)[ Fund](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&currency_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tc-lib-barcode%20project)[ RSS](/packages/hkvstore-tc-lib-barcode/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

tc-lib-barcode
==============

[](#tc-lib-barcode)

*PHP barcode library*

[![Latest Stable Version](https://camo.githubusercontent.com/c3c4c11f296f868d519296cf5cce4fe30688b0a3c4165af5b93ed3200aa9e5b4/68747470733a2f2f706f7365722e707567782e6f72672f7465636e69636b636f6d2f74632d6c69622d626172636f64652f76657273696f6e)](https://packagist.org/packages/tecnickcom/tc-lib-barcode)[![Master Build Status](https://camo.githubusercontent.com/dd2aa4c5a0c84252f8649f35df3462d35453a17dce95a0e7a0bf9e88feee6372/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f7465636e69636b636f6d2f74632d6c69622d626172636f64652e706e673f6272616e63683d6d61696e)](https://travis-ci.org/tecnickcom/tc-lib-barcode?branch=main)[![Master Coverage Status](https://camo.githubusercontent.com/bdf3568a5f2c2df02124640f577ed8af21677ef5e89c9b495e05487f85f8beb8/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7465636e69636b636f6d2f74632d6c69622d626172636f64652f62616467652e7376673f6272616e63683d6d61696e26736572766963653d676974687562)](https://coveralls.io/github/tecnickcom/tc-lib-barcode?branch=main)[![License](https://camo.githubusercontent.com/fe8d535cbdfb3b493a26bcd7fe81c6fa8968904dcd08d9bace460c977e7dcd0f/68747470733a2f2f706f7365722e707567782e6f72672f7465636e69636b636f6d2f74632d6c69622d626172636f64652f6c6963656e7365)](https://packagist.org/packages/tecnickcom/tc-lib-barcode)[![Total Downloads](https://camo.githubusercontent.com/23b118124e7a6b544a9c41a49a4fe185d6c49581e0140e11895c01909f25488f/68747470733a2f2f706f7365722e707567782e6f72672f7465636e69636b636f6d2f74632d6c69622d626172636f64652f646f776e6c6f616473)](https://packagist.org/packages/tecnickcom/tc-lib-barcode)

[![Donate via PayPal](https://camo.githubusercontent.com/e5f561f4f549822da3fbfb75d0be9059a60eac15b1ff7af66500ca1dd4dba91b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d70617970616c2d3837636565622e737667)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&currency_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tc-lib-barcode%20project)*Please consider supporting this project by making a donation via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&currency_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tc-lib-barcode%20project)*

- **category** Library
- **package** \\Com\\Tecnick\\Barcode
- **author** Nicola Asuni
- **copyright** 2001-2022 Nicola Asuni - Tecnick.com LTD
- **license**  GNU-LGPL v3 (see LICENSE.TXT)
- **link**
- **SRC DOC**

Description
-----------

[](#description)

This library includes utility PHP classes to generate linear and bidimensional barcodes:

- C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9
- C39+ : CODE 39 with checksum
- C39E : CODE 39 EXTENDED
- C39E+ : CODE 39 EXTENDED + CHECKSUM
- C93 : CODE 93 - USS-93
- S25 : Standard 2 of 5
- S25+ : Standard 2 of 5 + CHECKSUM
- I25 : Interleaved 2 of 5
- I25+ : Interleaved 2 of 5 + CHECKSUM
- C128 : CODE 128
- C128A : CODE 128 A
- C128B : CODE 128 B
- C128C : CODE 128 C
- EAN2 : 2-Digits UPC-Based Extension
- EAN5 : 5-Digits UPC-Based Extension
- EAN8 : EAN 8
- EAN13 : EAN 13
- UPCA : UPC-A
- UPCE : UPC-E
- MSI : MSI (Variation of Plessey code)
- MSI+ : MSI + CHECKSUM (modulo 11)
- POSTNET : POSTNET
- PLANET : PLANET
- RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
- KIX : KIX (Klant index - Customer index)
- IMB : IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
- IMBPRE : IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200- pre-processed
- CODABAR : CODABAR
- CODE11 : CODE 11
- PHARMA : PHARMACODE
- PHARMA2T : PHARMACODE TWO-TRACKS
- DATAMATRIX : DATAMATRIX (ISO/IEC 16022)
- PDF417 : PDF417 (ISO/IEC 15438:2006)
- QRCODE : QR-CODE
- RAW : 2D RAW MODE comma-separated rows
- RAW2 : 2D RAW MODE rows enclosed in square parentheses

### Output Formats

[](#output-formats)

- PNG Image
- SVG Image
- HTML DIV
- Unicode String
- Binary String

The initial source code has been derived from [TCPDF](http://www.tcpdf.org).

Getting started
---------------

[](#getting-started)

First, you need to install all development dependencies using [Composer](https://getcomposer.org/):

```
$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer
```

This project include a Makefile that allows you to test and build the project with simple commands. To see all available options:

```
make help
```

To install all the development dependencies:

```
make deps
```

Running all tests
-----------------

[](#running-all-tests)

Before committing the code, please check if it passes all tests using

```
make qa
```

All artifacts are generated in the target directory.

Examples
--------

[](#examples)

Examples are located in the `example` directory.

Start a development server (requires PHP 5.4) using the command:

```
make server

```

and point your browser to

### Simple Code Example

[](#simple-code-example)

Please check example/index.php for a full example.

```
// instantiate the barcode class
$barcode = new \Com\Tecnick\Barcode\Barcode();

// generate a barcode
$bobj = $barcode->getBarcodeObj(
    'QRCODE,H',                     // barcode type and additional comma-separated parameters
    'https://tecnick.com',          // data string to encode
    -4,                             // bar width (use absolute or negative value as multiplication factor)
    -4,                             // bar height (use absolute or negative value as multiplication factor)
    'black',                        // foreground color
    array(-2, -2, -2, -2)           // padding (use absolute or negative values as multiplication factors)
    )->setBackgroundColor('white'); // background color

// output the barcode as HTML div (see other output formats in the documentation and examples)
echo $bobj->getHtmlDiv();

```

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

[](#installation)

Create a composer.json in your projects root-directory:

```
{
    "require": {
        "tecnickcom/tc-lib-barcode": "^1.17"
    }
}
```

Or add to an existing project with:

```
composer require tecnickcom/tc-lib-barcode ^1.17
```

Packaging
---------

[](#packaging)

This library is mainly intended to be used and included in other PHP projects using Composer. However, since some production environments dictates the installation of any application as RPM or DEB packages, this library includes make targets for building these packages (`make rpm` and `make deb`). The packages are generated under the `target` directory.

When this library is installed using an RPM or DEB package, you can use it your code by including the autoloader:

```
require_once ('/usr/share/php/Com/Tecnick/Barcode/autoload.php');

```

Developer(s) Contact
--------------------

[](#developers-contact)

- Nicola Asuni

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

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

1339d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6fc3d3f9a4c5f6cba9ff19b64c2e628147bd91a391b81021d94c0908754330af?d=identicon)[hkvstore](/maintainers/hkvstore)

---

Top Contributors

[![nicolaasuni](https://avatars.githubusercontent.com/u/1186996?v=4)](https://github.com/nicolaasuni "nicolaasuni (202 commits)")[![remicollet](https://avatars.githubusercontent.com/u/270445?v=4)](https://github.com/remicollet "remicollet (3 commits)")[![Xclynaj](https://avatars.githubusercontent.com/u/75911906?v=4)](https://github.com/Xclynaj "Xclynaj (2 commits)")[![kristof-ringleff](https://avatars.githubusercontent.com/u/47804013?v=4)](https://github.com/kristof-ringleff "kristof-ringleff (1 commits)")[![maff](https://avatars.githubusercontent.com/u/27403?v=4)](https://github.com/maff "maff (1 commits)")[![hkvstore](https://avatars.githubusercontent.com/u/16445695?v=4)](https://github.com/hkvstore "hkvstore (1 commits)")[![cedric-anne](https://avatars.githubusercontent.com/u/33253653?v=4)](https://github.com/cedric-anne "cedric-anne (1 commits)")[![ulrich-berkmueller](https://avatars.githubusercontent.com/u/709350?v=4)](https://github.com/ulrich-berkmueller "ulrich-berkmueller (1 commits)")[![valioDOTch](https://avatars.githubusercontent.com/u/800467?v=4)](https://github.com/valioDOTch "valioDOTch (1 commits)")[![Caffe1neAdd1ct](https://avatars.githubusercontent.com/u/1327332?v=4)](https://github.com/Caffe1neAdd1ct "Caffe1neAdd1ct (1 commits)")

---

Tags

qr codedatamatrixpdf417barcodeCODABARupcStandard 2 of 5MSIPOSTNETKIXCBCplanetCODE 39royal mailtc-lib-barcodeANSI MH10.8M-1983USD-33 of 9CODE 93USS-93Interleaved 2 of 5EAN 8EAN 13UPC-AUPC-ERMS4CCKlantIntelligent Mail BarcodeOnecodeUSPS-B-3200CODE 11PHARMACODEPHARMACODE TWO-TRACKSECC200CODE 128 A B C

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/hkvstore-tc-lib-barcode/health.svg)

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

###  Alternatives

[tecnickcom/tc-lib-barcode

PHP library to generate linear and bidimensional barcodes

2957.1M28](/packages/tecnickcom-tc-lib-barcode)[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.5M87](/packages/picqer-php-barcode-generator)[barcode-bakery/barcode-1d

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

10146.1k1](/packages/barcode-bakery-barcode-1d)

PHPackages © 2026

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