janisvepris/zpl-builder-php
Composer 安装命令:
composer require janisvepris/zpl-builder-php
包简介
A simple PHP library for building ZPL (Zebra Programming Language) label payloads.
README 文档
README
zpl-builder-php
A small PHP 8.3+ library that generates ZPL II (Zebra Programming Language) label payloads via a fluent builder API. No runtime dependencies beyond PHP itself.
Status: work in progress — the public API is unstable until 1.0 and minor releases may include breaking changes. See
CHANGELOG.mdfor the per-version breakdown.
Installation
composer require janisvepris/zpl-builder-php
Supported PHP versions: 8.3, 8.4, 8.5.
Quick example
use Janisvepris\ZplBuilder\Enum\Font; use Janisvepris\ZplBuilder\ZplBuilder; $zpl = (string) ZplBuilder::start() ->labelHome(30, 30) ->changeFont(Font::Zero, 40, 20) ->fieldOrigin(50, 50) ->fieldData('Hello, ZPL!') ->fieldOrigin(50, 120) ->barcodeDefaults(3, 3.0, 100) ->barcodeCode128('ABC123') ->printQuantity(1) ->end(); // ^XA^LH30,30^CF0,40,20^FO50,50^FDHello, ZPL!^FS^FO50,120^BY3,3.0,100^BCN,100,Y,N,N,N^FDABC123^FS^PQ1^XZ
Send the resulting string to a Zebra printer over its preferred transport (raw TCP on port 9100, USB, serial, etc.).
Features
- Fluent builder with one method per ZPL command, named after the command's purpose (
fieldOrigin,changeFont,barcodeCode128, …). - Typed enums for ZPL parameters (
Orientation,Justify,Code128Mode,Font,Encoding, …) instead of bare strings. - Constructor-time validation on all command value objects — out-of-range numeric inputs throw a typed
RangeExceptionsubclass before the printer ever sees them. - Auto-escape of
^and~in field data via^FHso user content can't accidentally be interpreted as commands. - Escape hatch:
->raw('…')for any ZPL fragment the builder doesn't yet model. - Subclassable — no class is
final, so downstream consumers can add their own fluent methods or command value objects.
Escape hatch for unsupported commands
The library doesn't yet have dedicated methods for every ZPL command. For anything missing, pass a literal fragment through raw():
ZplBuilder::start() ->raw('^MD15') // media darkness — no native method yet ->raw('^PR4,4,4') // print rate ->end();
Reference
License
MIT — see LICENSE.
janisvepris/zpl-builder-php 适用场景与选型建议
janisvepris/zpl-builder-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.46k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「barcode」 「label」 「printer」 「zebra」 「zpl」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 janisvepris/zpl-builder-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 janisvepris/zpl-builder-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 janisvepris/zpl-builder-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
...so you don't forget where you are.
A PHP library for integrating 54grad.de's vehicle labeling services.
A PHPUnit result printer, variant of the TestDoxCli Printer, that reduces the test failure message size for better readability
Bundle providing a password encoder stack for support of legacy user data.
Reusable PHP traits for HTML rendering components: attribute management, content, templates, and prefix/suffix/label collections.
Symfony 4, 5, 6 ,7 Barcode Generator Bundle with Twig function extension
统计信息
- 总下载量: 2.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-09