定制 ramytalal/label-printer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ramytalal/label-printer

最新稳定版本:1.2.0

Composer 安装命令:

composer require ramytalal/label-printer

包简介

An implementation of the Brother label printer API.

README 文档

README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

This library is a WIP.

Easily print labels with a Brother label printer.

This library is tested with the following Brother printers,

so it may not work with other printers.

Install

Composer

$ composer require RamyTalal/Label-Printer

Usage

ESC/P

use Talal\LabelPrinter\Printer; use Talal\LabelPrinter\Mode\Escp; use Talal\LabelPrinter\Command; $stream = stream_socket_client('tcp://192.168.1.8:9100', $errorNumber, $errorString); $printer = new Printer(new Escp($stream)); $font = new Command\Font('brussels', Command\Font::TYPE_OUTLINE); $printer->addCommand(new Command\CharStyle(Command\CharStyle::NORMAL)); $printer->addCommand($font); $printer->addCommand(new Command\CharSize(46, $font)); $printer->addCommand(new Command\Align(Command\Align::CENTER)); $printer->addCommand(new Command\Text('Hallo')); $printer->addCommand(new Command\Cut(Command\Cut::FULL)); $printer->printLabel(); fclose($stream);

AutoCut Feature

// Disable the AutoCut on the printer $printer->addCommand(new Command\AutoCut(Command\AutoCut::DISABLED)); // Enable the AutoCut on the printer $printer->addCommand(new Command\AutoCut(Command\AutoCut::ENABLED));

Template

use Talal\LabelPrinter\Printer; use Talal\LabelPrinter\Mode\Template; use Talal\LabelPrinter\Command; $stream = stream_socket_client('tcp://192.168.1.8:9100', $errorNumber, $errorString); $printer = new Printer(new Template(2, $stream)); $printer->addCommand(new Command\ObjectCommand('title', 'R. Talal')); $printer->addCommand(new Command\ObjectCommand('address', 'H.H. Schefferlaan 9')); $printer->addCommand(new Command\ObjectCommand('postalcode', '7771 CW')); $printer->addCommand(new Command\ObjectCommand('city', 'Hardenberg')); $printer->printLabel(); fclose($stream);

Barcode generation

use Talal\LabelPrinter\Printer; use Talal\LabelPrinter\Mode\Template; use Talal\LabelPrinter\Command; $stream = stream_socket_client('tcp://192.168.1.8:9100', $errorNumber, $errorString); $printer = new Printer(new Template(2, $stream)); $printer->addCommand(new Command\Barcode('1234', 80, Command\Barcode::WIDTH_SMALL, 'code39', false, 2.5)); // or QR code // $printer->addCommand(new Command\QrCode('https://example.com')); $printer->printLabel(); fclose($stream);

Testing

$ composer test

TODO

  • Documentation

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 39.92k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 67
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 67
  • Watchers: 10
  • Forks: 21
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固