GitPedia

Tc lib barcode

PHP library to generate linear and bidimensional barcodes

From tecnickcom·Updated June 17, 2026·View on GitHub·

**tc lib barcode** is a PHP library to generate linear and bidimensional barcodes The project is written primarily in PHP, distributed under the Other license, first published in 2015. Key topics include: aztec, barcode, c128, c93, codabar.

tc-lib-barcode

PHP library for generating linear and 2D barcodes.

Latest Stable Version
Build
Coverage
License
Downloads

Sponsor on GitHub

If this project is useful to you, please consider supporting development via GitHub Sponsors.


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
AuthorNicola Asuni info@tecnick.com
LicenseGNU LGPL v3 - see LICENSE
API docshttps://tcpdf.org/docs/srcdoc/tc-lib-barcode
Packagisthttps://packagist.org/packages/tecnickcom/tc-lib-barcode

Supported Formats

Linear

FormatDescription
C39CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9
C39+CODE 39 with checksum
C39ECODE 39 EXTENDED
C39E+CODE 39 EXTENDED + CHECKSUM
C93CODE 93 - USS-93
S25Standard 2 of 5
S25+Standard 2 of 5 + CHECKSUM
I25Interleaved 2 of 5
I25+Interleaved 2 of 5 + CHECKSUM
C128CODE 128
C128ACODE 128 A
C128BCODE 128 B
C128CCODE 128 C
EAN22-Digits UPC-Based Extension
EAN55-Digits UPC-Based Extension
EAN8EAN 8
EAN13EAN 13
UPCAUPC-A
UPCEUPC-E
MSIMSI (Variation of Plessey code)
MSI+MSI + CHECKSUM (modulo 11)
CODABARCODABAR
CODE11CODE 11
PHARMAPHARMACODE
PHARMA2TPHARMACODE TWO-TRACKS

2D

FormatDescription
AZTECAZTEC Code (ISO/IEC 24778:2008)
DATAMATRIXDATAMATRIX (ISO/IEC 16022)
PDF417PDF417 (ISO/IEC 15438:2006)
QRCODEQR-CODE
RAW2D RAW MODE comma-separated rows
RAW22D RAW MODE rows enclosed in square parentheses

Postal

FormatDescription
POSTNETPOSTNET
PLANETPLANET
RMS4CCRMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
KIXKIX (Klant index - Customer index)
IMBIMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
IMBPREIMB - 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.2 or later
  • Extensions: bcmath, date, gd, pcre
  • Composer

Installation

bash
composer require tecnickcom/tc-lib-barcode

Quick Start

php
<?php require_once __DIR__ . '/vendor/autoload.php'; $barcode = new \Com\Tecnick\Barcode\Barcode(); $bobj = $barcode->getBarcodeObj( type: 'QRCODE,H', code: 'https://tecnick.com', width: -4, height: -4, color: 'black', padding: [-2, -2, -2, -2], )->setBackgroundColor('white'); echo $bobj->getInlineSvgCode();

For more formats and rendering options, see the example/ directory.


Development

bash
make deps make help make qa

To preview the example app in a browser:

bash
make server

Then open http://localhost:8000/ (served from the example/ directory).

To use a different port:

bash
make server PORT=8080

Build artifacts and reports are generated in target/.


Packaging

bash
make rpm make deb

For system packages, bootstrap with:

php
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.

Contributors

Showing top 10 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from tecnickcom/tc-lib-barcode via the GitHub API.Last fetched: 6/20/2026