wearepixel/zebra-php

PHP ZPL 构建器、图像转换和网络连接的 Zebra 标签打印机的基本客户端。

1.0.0 2024-06-03 12:05 UTC

This package is auto-updated.

Last update: 2024-09-13 03:14:07 UTC


README

PHP ZPL 构建器、图像转换和网络连接的 Zebra 标签打印机的基本客户端。

要求:PHP 8.0+

  • 将图像转换为 ASCII 十六进制。
  • 在 PHP 中创建易于阅读的 ZPL 代码。
  • PHP 套接字简单包装,通过原始 TCP/IP (端口 9100) 将 ZPL 发送到打印机。

示例

以下示例将打印一个标签,图像位于左上角 50 点处。

use Wearepixel\ZebraPhp\Client;
use Wearepixel\ZebraPhp\Zpl\Image;
use Wearepixel\ZebraPhp\Zpl\Builder;
use Wearepixel\ZebraPhp\Zpl\GdDecoder;

$decoder = GdDecoder::fromPath('example.png');
$image = new Image($decoder);

$zpl = new Builder();
$zpl->fo(50, 50)->gf($image)->fs();

$client = new Client('10.0.0.50');
$client->send($zpl);

使用 Composer 安装

$ composer require wearepixel/zebra-php

致谢

此库基于 Rob Gridley 的作品和他的仓库 zebra