Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Escpos Php Laravel Package

mike42/escpos-php

PHP library for ESC/POS receipt printers. Print text, images, barcodes, QR codes and cut paper over USB, network, serial or Windows share. Includes connectors and utilities for common thermal POS printers and cash drawers.

View on GitHub
Deep Wiki
Context7

PHP library for printing to ESC/POS-compatible thermal and impact printers

Frequently asked questions about Escpos Php
How do I install this package in a Laravel project?
Run `composer require mike42/escpos-php` in your project directory. No additional Laravel-specific setup is required, though you’ll need to configure printer connectors (e.g., network, USB) in your `config/printer.php` file.
Which Laravel versions does escpos-php support?
The package itself is PHP 7.4+ compatible, but Laravel integration depends on your setup. Tested with Laravel 8+ and 9+; ensure your PHP version matches Laravel’s requirements. No Laravel-specific dependencies exist.
Can I use this for async printing in Laravel?
Yes. Wrap print operations in a Laravel job (e.g., `PrintReceiptJob`) and dispatch them to a queue. This prevents blocking HTTP requests and handles high-volume printing efficiently.
How do I handle printer connection failures in production?
Use Laravel’s retry helper or queue dead-letter handling for failed jobs. For critical failures, implement a fallback (e.g., digital receipt via email) by catching exceptions in your job’s `handle()` method.
Does this support Epson, Star, or other thermal printer brands?
Yes. The library abstracts ESC/POS protocols, so it works with most thermal printers. Use vendor-specific `CapabilityProfile` settings (e.g., `simple`, `epson`, `star`) to handle quirks like barcode formatting or paper cuts.
How can I test receipt formatting without a physical printer?
Use the `FilePrintConnector` to save receipts as PDFs or text files for testing. Mock printer connectors in unit tests by extending `PrintConnector` and overriding methods like `send()` to return dummy responses.
What are the system requirements for USB/serial printing on Linux?
Ensure your Linux system has `php-serial` or `php-usb` extensions installed (depending on your printer interface). For USB, check permissions for `/dev/tty*` devices. Use `chmod` or `udev` rules if needed.
Can I integrate this with Laravel Notifications for hybrid receipts?
Yes. Extend Laravel’s `Notification` class to trigger both a physical receipt (via escpos-php) and a digital notification (e.g., email/SMS). Use the `via()` method to include `PrintChannel` alongside `MailChannel`.
How do I configure multiple printers for different store locations?
Bind printer connectors dynamically in your `PrinterServiceProvider` using Laravel’s IoC container. Store location-specific configs in the database or cache, then resolve the correct connector at runtime (e.g., `app()->make(NetworkPrintConnector::class, ['ip' => $location->printer_ip])).
Are there alternatives to escpos-php for Laravel receipt printing?
Other options include `php-escpos` (pure PHP, no Laravel integration) or vendor-specific SDKs (e.g., Star’s `StarIO`). However, escpos-php stands out for its Laravel-friendly design, queue support, and cross-platform compatibility.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
yandex/translate-api
voku/simple_html_dom
league/flysystem-vfs
bkwld/upchuck
filament/spatie-laravel-tags-plugin
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php