PHPackages                             mike42/escpos-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mike42/escpos-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mike42/escpos-php
=================

PHP receipt printer library for use with ESC/POS-compatible thermal and impact printers

v4.0(4y ago)2.8k2.0M↓23.2%885[522 issues](https://github.com/mike42/escpos-php/issues)[18 PRs](https://github.com/mike42/escpos-php/pulls)20MITPHPPHP &gt;=7.3.0CI failing

Since Jun 8Pushed 4mo ago140 watchersCompare

[ Source](https://github.com/mike42/escpos-php)[ Packagist](https://packagist.org/packages/mike42/escpos-php)[ Docs](https://github.com/mike42/escpos-php)[ RSS](/packages/mike42-escpos-php/feed)WikiDiscussions development Synced 1w ago

READMEChangelog (10)Dependencies (3)Versions (49)Used By (20)

ESC/POS Print Driver for PHP
============================

[](#escpos-print-driver-for-php)

[![Build Status](https://camo.githubusercontent.com/65919cb02d7c9951094e192e2c52299986c1863579bbf3c9431244bc412327cd/68747470733a2f2f7472617669732d63692e6f72672f6d696b6534322f657363706f732d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mike42/escpos-php) [![Latest Stable Version](https://camo.githubusercontent.com/4758fa49cc2904fe24e437b01248c4ed733a3404ee39c53e695a24650f66a617/68747470733a2f2f706f7365722e707567782e6f72672f6d696b6534322f657363706f732d7068702f762f737461626c65)](https://packagist.org/packages/mike42/escpos-php)[![Total Downloads](https://camo.githubusercontent.com/866973612c36c33dfd9afd575d4e4bb914771bb394b411a59c28cb2dbd1d60a1/68747470733a2f2f706f7365722e707567782e6f72672f6d696b6534322f657363706f732d7068702f646f776e6c6f616473)](https://packagist.org/packages/mike42/escpos-php)[![License](https://camo.githubusercontent.com/9c34b5d07e20bdd7bac297a3a61ef18c26ec658fba5bbab14072ae7c4778d59b/68747470733a2f2f706f7365722e707567782e6f72672f6d696b6534322f657363706f732d7068702f6c6963656e7365)](https://packagist.org/packages/mike42/escpos-php)[![Coverage Status](https://camo.githubusercontent.com/b3fc02f072ae944c0d0e6d56547325956cc1e1539d3ccdbe4c8dfbb3f05e979f/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d696b6534322f657363706f732d7068702f62616467652e7376673f6272616e63683d646576656c6f706d656e74)](https://coveralls.io/github/mike42/escpos-php?branch=development)

This project implements a subset of Epson's ESC/POS protocol for thermal receipt printers. It allows you to generate and print receipts with basic formatting, cutting, and barcodes on a compatible printer.

The library was developed to add drop-in support for receipt printing to any PHP app, including web-based point-of-sale (POS) applications.

Compatibility
-------------

[](#compatibility)

### Interfaces and operating systems

[](#interfaces-and-operating-systems)

This driver is known to work with the following OS/interface combinations:

 LinuxMacWindowsEthernet[Yes](https://github.com/mike42/escpos-php/tree/master/example/interface/ethernet.php)[Yes](https://github.com/mike42/escpos-php/tree/master/example/interface/ethernet.php)[Yes](https://github.com/mike42/escpos-php/tree/master/example/interface/ethernet.php)USB[Yes](https://github.com/mike42/escpos-php/tree/master/example/interface/linux-usb.php)Not tested[Yes](https://github.com/mike42/escpos-php/tree/master/example/interface/windows-usb.php)USB-serialYesYesYesSerialYesYesYesParallel[Yes](https://github.com/mike42/escpos-php/tree/master/example/interface/windows-lpt.php)Not testedYesSMB shared[Yes](https://github.com/mike42/escpos-php/tree/master/example/interface/smb.php)No[Yes](https://github.com/mike42/escpos-php/tree/master/example/interface/smb.php)CUPS hosted[Yes](https://github.com/mike42/escpos-php/tree/master/example/interface/cups.php)[Yes](https://github.com/mike42/escpos-php/tree/master/example/interface/cups.php)No### Printers

[](#printers)

Many thermal receipt printers support ESC/POS to some degree. This driver has been known to work with:

- 3nStar RPT-008
- Approx APPPOS80AM
- AURES ODP-333
- AURES ODP-500
- Bematech-4200-TH
- Bematech LR2000E
- Birch PRP-085III
- Bixolon SRP-350III
- Bixolon SRP-350Plus
- Black Copper BC-85AC
- CHD TH-305N
- Citizen CBM1000-II
- Citizen CT-S310II
- Dapper-Geyi Q583P
- Daruma DR800
- DR-MP200 (manufacturer unknown)
- EPOS TEP 220M
- Elgin i9
- Epson EU-T332C
- Epson FX-890 (requires `feedForm()` to release paper).
- Epson TM-T20
- Epson TM-T20II
- Epson TM-T70
- Epson TM-T70II
- Epson TM-T81
- Epson TM-T82II
- Epson TM-T88II
- Epson TM-T88III
- Epson TM-T88IV
- Epson TM-T88V
- Epson TM-U220
- Epson TM-U295 (requires `release()` to release slip).
- Epson TM-U590 and TM-U590P
- Equal (EQ-IT-001) POS-58
- Everycom EC-58
- Excelvan HOP-E200
- Excelvan HOP-E58
- Excelvan HOP-E801
- Gainscha GP-2120TF
- Gainscha GP-5890x (Also marketed as EC Line 5890x)
- Gainscha GP-U80300I (Also marketed as gprinter GP-U80300I)
- gprinter GP-U80160I
- HOIN HOP-H58
- Ithaca iTherm 28
- Hasar HTP 250
- Metapace T-1
- Metapace T-25
- Nexa PX700
- Nyear NP100
- OKI RT322
- OKI 80 Plus III
- Orient BTP-R580
- P-822D
- P85A-401 (make unknown)
- Partner Tech RP320
- POSLIGNE ODP200H-III-G
- QPOS Q58M
- Rongta RP326US
- Rongta RP58-U
- Rongta RP80USE
- SAM4S GIANT-100DB
- Senor TP-100
- Sewoo SLK-TS400
- SEYPOS PRP-96
- SEYPOS PRP-300 (Also marketed as TYSSO PRP-300)
- SNBC BTP-R880NPIII
- Solux SX-TP-88300
- Sicar POS-80
- Silicon SP-201 / RP80USE
- SPRT SP-POS88V
- Star BSC10
- Star TSP100 ECO
- Star TSP100III FuturePRNT
- Star TSP-650
- Star TUP-592
- TVS RP45 Shoppe
- Venus V248T
- Xeumior SM-8330
- Xprinter F-900
- Xprinter XP-365B
- Xprinter XP-58 Series
- Xprinter XP-80C
- Xprinter XP-90
- XPrinter XP-Q20011
- Xprinter XP-Q800
- Zjiang NT-58H
- Zjiang ZJ-5870
- Zjiang ZJ-5890 (Also sold as POS-5890 by many vendors; ZJ-5890K, ZJ-5890T also work).
- Zjiang ZJ-8220 (Also marketed as Excelvan ZJ-8220)
- Zjiang ZJ-8250

If you use any other printer with this code, please [let us know](https://github.com/mike42/escpos-php/issues/new) so that it can be added to the list.

Basic usage
-----------

[](#basic-usage)

### Include the library

[](#include-the-library)

#### Composer

[](#composer)

This library is designed for use with the `composer` PHP dependency manager. Simply add the `mike42/escpos-php` package to get started:

```
composer require mike42/escpos-php
```

If you haven't used `composer` before, you can read about it at [getcomposer.org](https://getcomposer.org/).

#### Requirements

[](#requirements)

This project has few hard dependencies:

- PHP 7.3 or newer.
- `json` extension, used to load bundled printer definitions (see [documentation](https://www.php.net/manual/en/book.json.php))
- `intl` extension, used for character encoding (see [documentation](https://www.php.net/manual/en/book.intl.php))
- `zlib` extension, used for de-compressing bundled resources (see [documentation](https://www.php.net/manual/en/book.zlib.php)).

It is also suggested that you install either `imagick` or `gd`, as these can be used to speed up image processing.

A number of optional extensions can be added to enable more specific features. These are described in the "suggest" section of [composer.json](https://github.com/mike42/escpos-php/tree/master/composer.json).

### The 'Hello World' receipt

[](#the-hello-world-receipt)

To make use of this driver, your server (where PHP is installed) must be able to communicate with your printer. Start by generating a simple receipt and sending it to your printer using the command-line.

```
