mazinsw / escpos
ESC/POS Printer Library
1.2.1
2023-08-21 21:23 UTC
Requires
- php: >= 8.1
- ext-mbstring: *
- endroid/qr-code: ^3.5.8
Requires (Dev)
- phpstan/phpstan: ^1.5
- phpunit/phpunit: ^9.5
- scrutinizer/ocular: ^1.6
- squizlabs/php_codesniffer: ^3.6
README
Library to generate buffer for thermal printers
Install
You need Composer to install this library.
Run command bellow on your project folder
composer require mazinsw/escpos
Basic example
<?php use Thermal\Printer; use Thermal\Connection\Buffer; use Thermal\Model; $model = new Model('MP-4200 TH'); $connection = new Buffer(); $printer = new Printer($model, $connection); $printer->setColumns(56); $printer->write('Simple Text *** '); $printer->writeln('Bold Text', Printer::STYLE_BOLD); $printer->writeln('Double height', Printer::STYLE_DOUBLE_HEIGHT | Printer::STYLE_BOLD, Printer::ALIGN_CENTER); $printer->qrcode('qrcode text'); $printer->feed(2); $printer->buzzer(); $printer->cutter(); $printer->drawer(Printer::DRAWER_1); echo $connection->getBuffer(); // redirect the output to your printer // php example.php > COM1
Dependencies
- PHP 8.1 or above
- Mbstring extension
License
Please see license file for more information.