tecnickcom / tc-lib-barcode
PHP library to generate linear and bidimensional barcodes
Fund package maintenance!
Requires
- php: >=8.1
- ext-bcmath: *
- ext-date: *
- ext-gd: *
- ext-pcre: *
- tecnickcom/tc-lib-color: ^2.3
Requires (Dev)
- pdepend/pdepend: ^2.16
- phpcompatibility/php-compatibility: ^10.0.0@dev
- phpmd/phpmd: ^2.15
- phpunit/phpunit: ^13.1 || ^12.5 || ^11.5 || ^10.5
- squizlabs/php_codesniffer: ^4.0
- dev-main
- 2.4.34
- 2.4.33
- 2.4.31
- 2.4.30
- 2.4.29
- 2.4.27
- 2.4.26
- 2.4.25
- 2.4.24
- 2.4.23
- 2.4.22
- 2.4.21
- 2.4.20
- 2.4.19
- 2.4.18
- 2.4.17
- 2.4.15
- 2.4.14
- 2.4.13
- 2.4.12
- 2.4.11
- 2.4.10
- 2.4.8
- 2.4.7
- 2.4.6
- 2.4.5
- 2.4.4
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.3
- 2.2.2
- 2.2.1
- 2.1.4
- 2.1.2
- 2.1.1
- 2.0.8
- 2.0.7
- 1.18.4
- 1.18.3
- 1.18.2
- 1.18.1
- 1.18.0
- 1.17.38
- 1.17.36
- 1.17.35
- 1.17.34
- 1.17.33
- 1.17.32
- 1.17.30
- 1.17.29
- 1.17.28
- 1.17.27
- 1.17.26
- 1.17.25
- 1.17.24
- 1.17.22
- 1.17.21
- 1.17.20
- 1.17.19
- 1.17.18
- 1.17.17
- 1.17.16
- 1.17.15
- 1.17.14
- 1.17.13
- 1.17.11
- 1.17.10
- 1.17.8
- 1.17.7
- 1.17.6
- 1.17.1
- 1.17.0
- 1.16.1
- 1.16.0
- 1.15.20
- 1.15.19
- 1.15.18
- 1.15.17
- 1.15.16
- 1.15.15
- 1.15.14
- 1.15.13
- 1.15.12
- 1.15.11
- 1.15.10
- 1.15.9
- 1.15.8
- 1.15.7
- 1.15.6
- 1.15.5
- 1.15.4
- 1.15.2
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.1
- 1.11.0
- 1.10.3
- 1.10.2
- 1.10.0
- 1.9.2
- 1.9.0
- 1.8.0
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.8
- 1.6.7
- 1.6.6
- 1.6.5
- 1.6.4
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.8
- 1.5.7
- 1.5.6
- 1.5.5
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.7
- 1.4.6
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
This package is auto-updated.
Last update: 2026-04-20 07:15:53 UTC
README
PHP library for generating linear and 2D barcodes.
If this library saves you time, please consider supporting development via PayPal.
Overview
tc-lib-barcode is a pure-PHP barcode generation library with broad support for industrial, retail, logistics, and document automation use cases.
It focuses on deterministic output and specification-driven encoding, making it suitable for labels, tickets, warehouse flows, and compliance documents. The API is structured so applications can generate barcode data once and render it as vectors or raster images depending on their output target.
| Namespace | \Com\Tecnick\Barcode |
| Author | Nicola Asuni info@tecnick.com |
| License | GNU LGPL v3 - see LICENSE |
| API docs | https://tcpdf.org/docs/srcdoc/tc-lib-barcode |
| Packagist | https://packagist.org/packages/tecnickcom/tc-lib-barcode |
Supported Formats
Linear
| Format | Description |
|---|---|
| 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) |
| CODABAR | CODABAR |
| CODE11 | CODE 11 |
| PHARMA | PHARMACODE |
| PHARMA2T | PHARMACODE TWO-TRACKS |
2D
| Format | Description |
|---|---|
| AZTEC | AZTEC Code (ISO/IEC 24778:2008) |
| 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 |
Postal
| Format | Description |
|---|---|
| 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 |
Rendering
- HTML output for web previews
- Image-based rendering for downstream processing
- Configurable dimensions, padding, and color
Output Formats
- PNG Image
- SVG Image
- HTML DIV
- Unicode String
- Binary String
Requirements
- PHP 8.1 or later
- Extensions:
bcmath,date,gd,pcre - Composer
Installation
composer require tecnickcom/tc-lib-barcode
Quick Start
<?php require_once __DIR__ . '/vendor/autoload.php'; $barcode = new \Com\Tecnick\Barcode\Barcode(); $bobj = $barcode->getBarcodeObj( 'QRCODE,H', 'https://tecnick.com', -4, -4, 'black', [-2, -2, -2, -2] )->setBackgroundColor('white'); echo $bobj->getHtmlDiv();
For more formats and rendering options, see the example/ directory.
Development
make deps
make help
make qa
Build artifacts and reports are generated in target/.
Packaging
make rpm make deb
For system packages, bootstrap with:
require_once '/usr/share/php/Com/Tecnick/Barcode/autoload.php';
Contributing
Contributions are welcome. Please read CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md before submitting a pull request.
Contact
Nicola Asuni - info@tecnick.com