negnetsolutions / php-barcode
受Nicola Asuni启发的条码生成包
dev-master
2024-02-01 18:46 UTC
Requires
- php: >=8.0.0
Requires (Dev)
- phpunit/phpunit: ^8.1
This package is auto-updated.
Last update: 2024-08-30 20:03:06 UTC
README
这是一个受Nicola Asuni启发的条码生成包。实际上,我使用该包的底层类来生成条码。此包只是该包的包装,并增加了与PHP >= 5.4的兼容性。
我使用了该包的以下类。
- lib/Barcode1D.php (tcpdf_barcodes_1d.php)
- lib/Barcode2D.php (tcpdf_barcodes_2d.php)
- lib/QRcode.php (include/barcodes/qrcode.php)
- lib/Datamatrix.php (include/barcodes/datamatrix.php)
- lib/PDF417.php (include/barcodes/pdf417.php)
支持
支持以下条码生成器:QRCode、PDF417、Datamatrix、C39、C39+、C39E、C39E+、C93、S25、S25+、I25、I25+、C128、C128A、C128B、C128C、基于UPC的2位扩展、基于UPC的5位扩展、EAN 8、EAN 13、UPC-A、UPC-E、MSI(Plessey代码的变体)在HTML、PNG和SVG中。
此包与PHP >= 5.4兼容
此包需要php-gd扩展。因此,请确保它在您的机器上已安装。
安装
首先,通过Composer安装此包。只需在终端运行以下命令即可
composer require negnetsolutions/php-barcode
您还可以编辑项目中的composer.json
文件,以要求negnetsolutions/php-barcode
。
"require": {
...
"negnetsolutions/php-barcode": "^1.0"
}
接下来,从终端更新Composer
composer update
基本用法
use jucksearm\barcode\Barcode; Barcode::html('https://github.com/negnetsolutions/php-barcode', 'C128');
高级用法
use jucksearm\barcode\Barcode; Barcode::factory() ->setCode('https://github.com/jucksearm/php-barcode') ->setType('C128') ->setScale(null) ->setHeight(null) ->setRotate(null) ->setColor(null) ->renderHTML();
条码选项
Barcode::html($code, $type, $scale = null, $height = null, $rotate = null, $color = null) Barcode::png($code, $type, $file= null, $scale = null, $height = null, $rotate = null, $color = null) Barcode::svg($code, $type, $file= null, $scale = null, $height = null, $rotate = null, $color = null)
$type C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, EAN2, EAN5, EAN8, EAN13, UPCA, UPCE, MSI, MSI+, POSTNET, PLANET, RMS4CC, KIX, IMB, CODABAR, CODE11, PHARMA, PHARMA2T $file Barcode save filename [default: `null`] $scale Barcode unit size in `px` units [default: `1`] $height Barcode height in `px` units [default: `30`] $rotate Support 0, 90 in `degrees` units [default: `0`] $color Support in `hexadecimal` color units [default: `000`]
QRcode选项
QRcode::html($code, $emblem = null, $level = null, $size = null, $margin = null, $color = null) QRcode::png($code, $emblem = null, $file = null, $level = null, $size = null, $margin = null, $color = null) QRcode::svg($code, $emblem = null, $file = null, $level = null, $size = null, $margin = null, $color = null)
$emblem Insert mask Logo [default: `null`] $file QRcode save filename [default: `null`] $level QRcode level L,M,Q,H [default: `L`] $size QRcode width and height size in `px` units [default: `100`] $margin QRcode empty space in `percentage` units [default: `1`] $color Support in `hexadecimal` color units [default: `000`]
Datamatrix选项
Datamatrix::html($code, $size = null, $margin = null, $color = null) Datamatrix::png($code, $file = null, $size = null, $margin = null, $color = null) Datamatrix::svg($code, $file = null, $size = null, $margin = null, $color = null)
$file Datamatrix save filename [default: `null`] $size Datamatrix width and height size in `px` units [default: `100`] $margin Datamatrix empty space in `percentage` units [default: `1`] $color Support in `hexadecimal` color units [default: `000`]
PDF417选项
PDF417::html($code, $size = null, $margin = null, $color = null) PDF417::png($code, $file = null, $size = null, $margin = null, $color = null) PDF417::svg($code, $file = null, $size = null, $margin = null, $color = null)
$file PDF417 save filename [default: `null`] $size PDF417 width and height size in `px` units [default: `100`] $margin PDF417 empty space in `percentage` units [default: `1`] $color Support in `hexadecimal` color units [default: `000`]
许可证
此包在GNU LGPLv3
许可证下发布,版权属于Jucksearm Boonmor。原始条码生成类由Nicola Asuni编写。许可协议位于项目的根目录。
许可证:GNU LGPLv3
- 原始包 Nicola Asuni https://github.com/tecnickcom/TCPDF
- 链接 http://www.tcpdf.org
- 包版权 Jucksearm Boonmor jucksearm.bkk@gmail.com