amattu2/avery-fpdf-labels
Composer 安装命令:
composer require amattu2/avery-fpdf-labels
包简介
A PHP library designed to assist in building Avery Label sheets with FPDF
README 文档
README
This is a PHP project to implement support for generating Avery.com label templates using FPDF.
Templates
Supported
The currently implemented templates are listed below.
- Avery 5160
- Avery 5163
- Avery Presta 94107
- Avery 5392
Upcoming
There are plans to support the following templates but If you have an urgent need for a specific template to be supported, open a issue to let me know.
- Avery 5162
- Avery 5195
- Avery 5816
- Avery 5817
- Avery 8160
Feel free to contribute to the development effort by submitting a pull request for any of the above templates or any other templates you would like to see supported.
Usage
Install
Composer
To install via composer, follow the simple steps below.
composer install amattu2/avery-fpdf-labels composer install fpdf/fpdf
NOTE: You can use any fork of FPDF you want as long as it implements the same methods as FPDF.
Then
require 'vendor/autoload.php'; $template = new amattu2\LabelSheet("Avery5160"); $pdf = new Fpdf\Fpdf();
Direct
If you choose to install without composer support, you can clone the repository directly. You will need to include FPDF also.
git clone https://github.com/amattu2/avery-fpdf-labels
Then
require 'fpdf/Fpdf.php'; // Install FPDF manually require 'src/LabelSheet.php'; $template = new amattu2\LabelSheet("Avery5160"); $pdf = new Fpdf\Fpdf();
Usage
See example.php for demonstration of usage.
Text Label
Use the addTextLabel method to add a text label to the template. The method accepts an array of strings, an optional alignment parameter, and optional row and column parameters. This would typically be used for address labels.
addTextLabel(array $lines, ?string $align = "C", int $row = null, int $col = null): void
$template->addTextLabel([ "line 1", "line 2", "line 3", // ... ])
Image Label
Use the addImageLabel method to add an image label to the template. The method accepts a path to an image file and optional row and column parameters.
addImageLabel(string $path, int $row = null, int $col = null): void
$template->addImageLabel("https://api.placeholder.app/image/350x350/.png");
Custom Labels
The addCustomLabel method allows you to expand upon the current label types (e.g. adding barcodes). You must instantiate your own implementation of the custom label and pass it to this method.
addCustomLabel(LabelInterface $label): void
The custom label must implement the LabelInterface interface. See /src/LabelInterface.php for more information.
Requirements & Dependencies
- FPDF 1.81 Minimum [http://www.fpdf.org/]
- PHP 7.4+ [https://php.net]
amattu2/avery-fpdf-labels 适用场景与选型建议
amattu2/avery-fpdf-labels 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.71k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2023 年 01 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 amattu2/avery-fpdf-labels 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 amattu2/avery-fpdf-labels 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10.71k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2023-01-24