定制 eriquegasparcarlos/esolutions-escpos 二次开发

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

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

eriquegasparcarlos/esolutions-escpos

Composer 安装命令:

composer require eriquegasparcarlos/esolutions-escpos

包简介

PHP client para impresión ESC/POS via ApiPeruDevPrint

README 文档

README

PHP client para impresión ESC/POS via ApiPeruDevPrint.

Reemplaza mike42/escpos-php con una API fluida que envía comandos a ApiPeruDevPrint, el servicio local de impresión.

Instalación

composer require eriquegasparcarlos/esolutions-escpos

Requisitos

Uso básico

use ESolutions\Escpos\Document;
use ESolutions\Escpos\Printer;

$doc = Document::make()
    ->textCenter('MI EMPRESA SAC', bold: true, size: 2)
    ->textCenter('RUC: 20123456789')
    ->separator()
    ->row('Cliente:', 'Juan Pérez')
    ->row('Fecha:', '16/04/2026')
    ->separator()
    ->columns([
        ['text' => 'Producto A x2', 'width' => 28, 'align' => 'left'],
        ['text' => 'S/ 20.00',      'width' => 10, 'align' => 'right'],
    ])
    ->columns([
        ['text' => 'Producto B x1', 'width' => 28, 'align' => 'left'],
        ['text' => 'S/  5.00',      'width' => 10, 'align' => 'right'],
    ])
    ->separator()
    ->textRight('TOTAL: S/ 29.50', bold: true)
    ->feed(1)
    ->qr('https://cpe.sunat.gob.pe/...')
    ->cut();

Printer::create()
    ->to('TP-300')
    ->paper80mm()
    ->send($doc);

Métodos del Document

Método Descripción
text($text, $align, $bold, $underline, $size, $font) Texto con formato
textCenter($text, $bold, $size) Texto centrado
textRight($text, $bold) Texto alineado a la derecha
bold($text, $align, $size) Texto en negrita
small($text, $align) Texto pequeño (font B)
columns($columns) Columnas en una fila
row($label, $value, $paperWidth) Fila etiqueta / valor
separator() Línea separadora
feed($lines) Avance de líneas
qr($data, $size, $align) Código QR
barcode($data, $type, $align) Código de barras
imageBase64($base64, $width, $align) Imagen desde base64
imageFile($path, $width, $align) Imagen desde archivo
cut() Corte de papel
openDrawer() Abrir cajón de dinero

Métodos del Printer

Printer::create()
    ->to('Nombre Impresora')   // nombre de la impresora
    ->paper58mm()              // 32 chars/línea
    ->paper80mm()              // 48 chars/línea (default)
    ->paperWidth(48)           // ancho personalizado
    ->withCut(true)            // cortar al final (default: true)
    ->withDrawer(false)        // abrir cajón (default: false)
    ->url('https://localhost:8443') // URL de ApiPeruDevPrint
    ->send($document);

Listar impresoras disponibles

$printers = Printer::availablePrinters();
// ['TP-300', 'Microsoft Print to PDF', ...]

Integración con Laravel

// En un Service Provider o directamente en el controlador:
use ESolutions\Escpos\Document;
use ESolutions\Escpos\Printer;
use ESolutions\Escpos\Exceptions\PrinterException;

try {
    $doc = Document::make()
        ->textCenter('Boleta de Venta', bold: true)
        // ...
        ->cut();

    Printer::create()->to(config('printing.printer'))->send($doc);
} catch (PrinterException $e) {
    Log::error('Error de impresión: ' . $e->getMessage());
}

Licencia

MIT

eriquegasparcarlos/esolutions-escpos 适用场景与选型建议

eriquegasparcarlos/esolutions-escpos 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「pos」 「receipt」 「printer」 「escpos」 「thermal」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 eriquegasparcarlos/esolutions-escpos 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 eriquegasparcarlos/esolutions-escpos 我们能提供哪些服务?
定制开发 / 二次开发

基于 eriquegasparcarlos/esolutions-escpos 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 30
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

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