charlieuki/receiptprinter
A PHP library for printing receipts on thermal ESC/POS printers. It supports USB, network, Windows and Linux connections, with a simple API for formatting text, images, barcodes and QR codes. Easily integrated into Laravel or any PHP application.
composer require charlieuki/receiptprinter. On Laravel 5.5+ the service provider should be auto-discovered; on older versions register Charlieuki\ReceiptPrinter\ReceiptPrinterServiceProvider manually.config/receiptprinter.php first. This is where the connector (network or cups), printer address/name, paper width, currency, and store details are defined.9100.Charlieuki\ReceiptPrinter\ReceiptPrinter, set the store, currency, items, totals, paid amount, and change, then call printReceipt(). Confirm the physical output before wiring it to real orders.ReceiptPrinter class early. It is a thin convenience wrapper around mike42/escpos-php, so most formatting and connector behavior ultimately comes from that underlying library.printLogo() and openDrawer() in the same Tinker smoke test. Both are new and explicitly flagged as untested upstream, so validate them on your hardware before relying on them.ReceiptPrinter directly from controllers. A ReceiptService or PrintOrderReceipt action keeps receipt construction, store lookup, and error handling in one place.ShouldQueue, sensible tries, backoff, and a failed() handler.stores table, validate the ID before printing, and pass it via setStore(). This makes one deployment serve multiple outlets.printLogo()), whether the drawer should be kicked, and whether the receipt should include item codes or SKUs.printLogo() before the body to place a store logo at the top of the receipt, and openDrawer() to kick the cash drawer wired to the printer’s RJ11 port. Treat the drawer kick as a separate concern from the receipt itself: call it on cash-tender flows, not on card payments or reprints, and consider isolating it in its own small service method so a drawer failure does not prevent the receipt from printing (and vice versa).mike42/escpos-php, which is effectively unmaintained. Check PHP 8.x compatibility, pin versions, and be prepared to fork or patch if you rely on it long-term.printLogo() and openDrawer() are brand new in 1.2.5a and the maintainer states they still need testing. Do not assume the method signatures, argument order, or behavior are stable, and do not silently depend on them in production without a hardware smoke test on each printer model and paper width you support.printLogo() fails or produces garbage, pre-process the image yourself (greyscale, threshold, resize) rather than passing arbitrary PNG/JPG files.openDrawer() only works if the drawer is physically connected to the printer’s drawer port and the printer supports the standard kick command with the expected pin (usually pin 2, sometimes pin 5). A no-op drawer usually means wiring or pin number, not code.9100. There is no authentication or transport security. Ensure the queue worker host can reach the printer, open the firewall where needed, and set connection timeouts so jobs fail fast..env, run php artisan config:clear or php artisan config:cache. Printer host, store, and logo path changes will not apply while an old config cache is active.printReceipt(), printLogo(), and openDrawer() in try/catch, log the exception, and monitor failed jobs. Test the unreachable-printer path deliberately.How can I help you explore Laravel packages today?