PHPackages                             gblix/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. gblix/escpos-php

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

gblix/escpos-php
================

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

5.1.0(1mo ago)042MITPHPPHP ^8.2

Since Jun 8Pushed 1mo agoCompare

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

READMEChangelog (2)Dependencies (3)Versions (51)Used By (0)

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

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

> **Maintained by [GBLIX](https://github.com/GBLIX).** Originally forked from [mike42/escpos-php](https://github.com/mike42/escpos-php) (upstream abandoned, last commit March 2021). See [Changes](#changes) for details on what has changed since the upstream release.

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.

Changes
-------

[](#changes)

This fork targets **PHP 8.2+** and resolves all PHP 8.4 deprecation warnings present in the upstream release.

### v5.1.0 (2026-05-03)

[](#v510-2026-05-03)

- **Switched image dependency to `gblix/gfx-php ^1.0`** (was `mike42/gfx-php`), now sourced directly from Packagist.
- **Added full type hints** across all core classes: `EscposImage`, `GdEscposImage`, `ImagickEscposImage`, `NativeEscposImage`, `CodePage`, `PrintConnector` interface and all implementations.

### v5.0.0 (2026-05-03)

[](#v500-2026-05-03)

- **Renamed package to `gblix/escpos-php`** — install with `composer require gblix/escpos-php`.
- **PHP requirement bumped to `^8.2`** (upstream required `>=7.3`).
- **Fixed all implicit nullable parameter deprecations** across the library (`Type $param = null` → `?Type $param = null`). Affected files: `Printer.php`, `EscposImage.php`, `GdEscposImage.php`, `ImagickEscposImage.php`, `NativeEscposImage.php`, `PrintBuffer.php`, `EscposPrintBuffer.php`, `ImagePrintBuffer.php`, `UnifontPrintBuffer.php`.
- **Fixed dynamic property deprecation** in `Experimental/Unifont/FontMap.php` (PHP 8.2+).
- **Updated test suite to PHPUnit ^11** (from ^9) for PHP 8.4 support; updated `phpunit.xml` to the PHPUnit 10/11 configuration schema.
- **Updated mock API in tests**: `setMethods()` → `onlyMethods()` (removed in PHPUnit 10).
- **Updated `UriPrintConnectorTest`**: replaced removed `expectNotice()` with `set_error_handler`.
- **Added `Dockerfile` and `docker-compose.yml`** for running tests without a local PHP installation.
- **Added `repositories` VCS fallback** for `mike42/gfx-php` pointing to `GBLIX/gfx-php`.
- No ESC/POS logic, command bytes, or public API signatures were changed.

### Running tests (Docker)

[](#running-tests-docker)

No local PHP required:

```
# Build the PHP 8.4 test image
docker build -t escpos-php-test .

# Run the unit test suite
docker run --rm escpos-php-test

# Run with docker-compose
docker compose run --rm php
```

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/GBLIX/escpos-php/tree/master/example/interface/ethernet.php)[Yes](https://github.com/GBLIX/escpos-php/tree/master/example/interface/ethernet.php)[Yes](https://github.com/GBLIX/escpos-php/tree/master/example/interface/ethernet.php)USB[Yes](https://github.com/GBLIX/escpos-php/tree/master/example/interface/linux-usb.php)Not tested[Yes](https://github.com/GBLIX/escpos-php/tree/master/example/interface/windows-usb.php)USB-serialYesYesYesSerialYesYesYesParallel[Yes](https://github.com/GBLIX/escpos-php/tree/master/example/interface/windows-lpt.php)Not testedYesSMB shared[Yes](https://github.com/GBLIX/escpos-php/tree/master/example/interface/smb.php)No[Yes](https://github.com/GBLIX/escpos-php/tree/master/example/interface/smb.php)CUPS hosted[Yes](https://github.com/GBLIX/escpos-php/tree/master/example/interface/cups.php)[Yes](https://github.com/GBLIX/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/GBLIX/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 `gblix/escpos-php` package to get started:

```
composer require gblix/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 8.2 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/GBLIX/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.

```
