tecnickcom/tc-lib-barcode
Composer 安装命令:
composer require tecnickcom/tc-lib-barcode
包简介
PHP library to generate linear and bidimensional barcodes
关键字:
README 文档
README
PHP library for generating linear and 2D barcodes.
💖 Part of the tc-lib-pdf / TCPDF ecosystem (100M+ installs). Sponsor its maintenance →
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.2 or later
- Extensions:
bcmath,gd - 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( 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
make deps
make help
make qa
To preview the example app in a browser:
make server
Then open http://localhost:8000/ (served from the example/ directory).
To use a different port:
make server PORT=8080
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.
tecnickcom/tc-lib-barcode 适用场景与选型建议
tecnickcom/tc-lib-barcode 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.93M 次下载、GitHub Stars 达 297, 最近一次更新时间为 2015 年 09 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「barcode」 「datamatrix」 「pdf417」 「planet」 「aztec」 「CODE 39」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tecnickcom/tc-lib-barcode 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tecnickcom/tc-lib-barcode 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tecnickcom/tc-lib-barcode 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
TCPDF is a PHP class for generating PDF documents and barcodes.
Bundle providing a password encoder stack for support of legacy user data.
Symfony 4, 5, 6 ,7 Barcode Generator Bundle with Twig function extension
GS1 parser and generator for PHP
Symfony2 Barcode Generator Bundle with Twig function extension
PHP QR code decoder / reader
统计信息
- 总下载量: 7.93M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 303
- 点击次数: 39
- 依赖项目数: 41
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2015-09-12