tklovett/barcodes
最新稳定版本:V3.0
Composer 安装命令:
composer require tklovett/barcodes
包简介
Barcode generator for PHP supporting 20+ barcode types
README 文档
README
Generating barcodes in PHP since 2015!
Generates HTML, PNG, or SVG canvas
Supported Barcode Types
One Dimensional
- Codabar
- Code 11
- Code 39 (also extended and/or with check-digit)
- Code 93
- Code 128 (A, B, C, or Auto)
- EAN (2, 5, 13)
- Intelligent Mail
- Interleave 2 of 5
- MSI (also with check-digit)
- Pharmacode
- POSTNET (or PLANET)
- RMS4CC (or KIX)
- Standard 2 of 5 (also with check-digit)
- UPC (A, E)
Two Dimensional
- DataMatrix
- PDF417
- QR Code
Requirements
- Barcodes requires ImageMagick to create PNGs in PHP 5.3.
- Barcodes requires PHP bcmath extension for Intelligent Mail barcodes
Installation
You can install this package with the Composer CLI:
composer require tklovett/barcodes
Or manually add the dependency to your project's composer.json:
"require": {
"tklovett/barcodes": "dev-master"
}
And tell composer to install it:
composer install
Usage
First instantiate a BarcodeGenerator factory:
$generator = new BarcodeGenerator();
Then tell it to generate the barcode type of your choice for your code:
$barcode = generator.generate(BarcodeType::QR_CODE, "This is what I want encoded");
Finally, output SVG, HTML, or a PNG:
$svg = $barcode.toSVG(); $html = $barcode.toHTML(); $png = $barcode.toPNG();
Need a custom height, width, or color for your barcode? No problem:
$width = 20; $height = 30; $color = 'blue'; $sizedSVG = $barcode.toSVG($width, $height, $color); $sizedHTML = $barcode.toSVG($width, $height, $color); $sizedPNG = $barcode.toSVG($width, $height, $color);
TODO:
- Convert snake_case method names to camelCase
- Replace returns from barcode constructors with exception throws
- Write tests
- Write docs
- parent::__construct($code); in all barcodes
- remove unused methods
tklovett/barcodes 适用场景与选型建议
tklovett/barcodes 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 152 次下载、GitHub Stars 达 5, 最近一次更新时间为 2015 年 01 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「barcode」 「qr code」 「qrcode」 「laravel」 「datamatrix」 「pdf417」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tklovett/barcodes 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tklovett/barcodes 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tklovett/barcodes 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Bundle providing a password encoder stack for support of legacy user data.
Based in http://phpqrcode.sourceforge.net/
Symfony 4, 5, 6 ,7 Barcode Generator Bundle with Twig function extension
GS1 parser and generator for PHP
Generates QR Codes
统计信息
- 总下载量: 152
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-18