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
- PHP 8.1+
- ext-json, ext-curl
- ApiPeruDevPrint corriendo en
localhost:8443
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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 eriquegasparcarlos/esolutions-escpos 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHPUnit result printer, variant of the TestDoxCli Printer, that reduces the test failure message size for better readability
Use OpenAI to extract structured receipt and invoice data from Text, Html, Images and PDFs.
Onslip 360 PHP SDK
Szamlazz.hu PHP integration, package version
Szamlazz.hu integration for Laravel
PHP receipt validator for Apple iTunes, Google Play and Amazon App Store
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-16