PHPackages                             php-aidc/label-printer - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. php-aidc/label-printer

ActiveLibrary[File &amp; Storage](/categories/file-storage)

php-aidc/label-printer
======================

Easily create and print labels on various label printers

v0.4(4y ago)5922.0k↓22.7%12[2 issues](https://github.com/php-aidc/label-printer/issues)[1 PRs](https://github.com/php-aidc/label-printer/pulls)MITPHPPHP &gt;=7.1CI failing

Since Jun 30Pushed 4y ago4 watchersCompare

[ Source](https://github.com/php-aidc/label-printer)[ Packagist](https://packagist.org/packages/php-aidc/label-printer)[ Docs](https://github.com/php-aidc/label-printer)[ RSS](/packages/php-aidc-label-printer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (6)Used By (0)

PhpAidc LabelPrinter
====================

[](#phpaidc-labelprinter)

 [![Latest Version on Packagist](https://camo.githubusercontent.com/aaf49723ea41a0ab6d1f4296d9c5927c717b2f6596966aa53b588c427275aa5a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068702d616964632f6c6162656c2d7072696e7465722e7376673f7374796c653d666c6174)](https://packagist.org/packages/php-aidc/label-printer) [![Testing](https://github.com/php-aidc/label-printer/workflows/tests/badge.svg)](https://github.com/php-aidc/label-printer/actions?workflow=tests) [![Quality Score](https://camo.githubusercontent.com/9492af955495ee50ec60f0aada1a4e51d738b88ba79bc7468d248aa0e39490df/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7068702d616964632f6c6162656c2d7072696e7465722e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/php-aidc/label-printer) [![Code Coverage](https://camo.githubusercontent.com/0874b1d5b41bdbc3a54cabda12907795e70f37fb12742ef96b5c0e79a7fdf3cd/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7068702d616964632f6c6162656c2d7072696e7465722f6d61737465722e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/php-aidc/label-printer/?branch=master) [![Total Downloads](https://camo.githubusercontent.com/4bb51c5a5e523388bc3a31c14d7d29fa39b2e2d191349d38297f281112917ba5/68747470733a2f2f706f7365722e707567782e6f72672f7068702d616964632f6c6162656c2d7072696e7465722f646f776e6c6f6164733f666f726d61743d666c6174)](https://packagist.org/packages/php-aidc/label-printer) [![License MIT](https://camo.githubusercontent.com/f79902e6b5b4779c7a7f3ae4b27fbedbec49951bb4999281472058ec735bb0fe/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d343238463745)](https://raw.githubusercontent.com/php-aidc/label-printer/master/LICENSE.md)

PhpAidc LabelPrinter is a library that help you create and print labels on printers that support Direct Protocol, Fingerprint, TSPL/TSPL2 languages (Honeywell, Intermec, TSC) via TCP/IP.

---

- [Requirements](#requirements)
- [Installation](#installation)
- [Basic usage](#basic-usage)

Requirements
------------

[](#requirements)

- PHP 7.1+
- ext-mbstring

Installation
------------

[](#installation)

LabelPrinter is installed via [Composer](https://getcomposer.org/):

```
composer require php-aidc/label-printer
```

You can of course also manually edit your composer.json file

```
{
    "require": {
       "php-aidc/label-printer": "v0.4"
    }
}
```

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

[](#basic-usage)

> Some TSPL2-like printers, such as Atol BP41/Rongta RP410, do not support all TSPL2 features.

#### Read data from printer

[](#read-data-from-printer)

```
use PhpAidc\LabelPrinter\Printer;
use PhpAidc\LabelPrinter\Connector\NetworkConnector;

$printer = new Printer(new NetworkConnector('192.168.x.x'));

\var_dump($printer->ask('? VERSION$(0)'));

// "Direct Protocol  10.15.017559   \r\n"
```

#### Create and print label

[](#create-and-print-label)

```
use PhpAidc\LabelPrinter\Enum\Unit;
use PhpAidc\LabelPrinter\Enum\Anchor;
use PhpAidc\LabelPrinter\Enum\Charset;
use PhpAidc\LabelPrinter\Printer;
use PhpAidc\LabelPrinter\Label\Label;
use PhpAidc\LabelPrinter\Label\Element;
use PhpAidc\LabelPrinter\CompilerFactory;
use PhpAidc\LabelPrinter\Connector\NetworkConnector;

$label = Label::create(Unit::MM(), 43, 25)
    ->charset(Charset::UTF8())
    ->add(Element::textBlock(168, 95, 'Hello!', 'Univers', 8)->box(338, 100, 0)->anchor(Anchor::CENTER()))
    ->add(Element::barcode(10, 10, '123456', 'CODE93')->height(60))
;

(new Printer(new NetworkConnector('192.168.x.x'), CompilerFactory::tspl()))->print($label);
```

#### Add elements only for a specific language

[](#add-elements-only-for-a-specific-language)

```
use PhpAidc\LabelPrinter\Label\Label;
use PhpAidc\LabelPrinter\Label\Element;
use PhpAidc\LabelPrinter\Language\Tspl;
use PhpAidc\LabelPrinter\Language\Fingerprint;

$label = Label::create()
    ->for(Fingerprint::class, static function (Label $label) {
        $label->add(Element::textLine(168, 95, 'Hello!', 'Univers', 8));
    })
    ->for(Tspl::class, static function (Label $label) {
        $label->add(Element::textLine(10, 10, 'Hello!', 'ROMAN.TTF', 8));
    })
;
```

#### Add elements if some value is truthy

[](#add-elements-if-some-value-is-truthy)

```
use PhpAidc\LabelPrinter\Label\Label;
use PhpAidc\LabelPrinter\Label\Element;

$text = '';

$label = Label::create()
    ->when($text, static function (Label $label, $text) {
        // will not be added until the $text is empty
        $label->add(Element::textLine(168, 95, $text, 'Univers', 8));
    })
;
```

#### Print images

[](#print-images)

```
use PhpAidc\LabelPrinter\Label\Label;
use PhpAidc\LabelPrinter\Label\Element;
use PhpAidc\LabelPrinter\Language\Tspl;
use PhpAidc\LabelPrinter\Language\Fingerprint;

$image = new \Imagick('gift.svg');

$label = Label::create()
    ->for(Fingerprint::class, static function (Label $label) {
        // from printer's memory — png, bmp, pcx
        $label->add(Element::intImage(10, 10, 'GLOBE.1'));
        // from filesystem
        $label->add(Element::extImage(10, 10, \realpath('alien.png')));
    })
    ->for(Tspl::class, static function (Label $label) {
        // from printer's memory — bmp, pcx
        $label->add(Element::intImage(10, 10, 'ALIEN.BMP'));
    })
    // from filesystem via Imagick — any supported types
    ->add(Element::bitmap(50, 10, $image))
;
```

#### Print text with emulation

[](#print-text-with-emulation)

```
use PhpAidc\LabelPrinter\Label\Label;
use PhpAidc\LabelPrinter\Label\Element;

$label = Label::create()
    ->add(Element::textLine(10, 10, 'Hello!', '/path/to/font/roboto.ttf', 20)->emulate())
    ->add(Element::textBlock(100, 10, 'Hello again!', '/path/to/font/roboto.ttf', 20)->box(300, 20)->emulate())
;
```

Text will be drawn with Imagick and printed as bitmap.

#### Specify the number of copies

[](#specify-the-number-of-copies)

```
use PhpAidc\LabelPrinter\Label\Label;
use PhpAidc\LabelPrinter\Label\Element;

$label = Label::create()
    ->add(Element::textLine(168, 95, 'Hello!', 'Univers', 8))
    ->copies(3)
;
```

#### Batch printing

[](#batch-printing)

```
use PhpAidc\LabelPrinter\Printer;
use PhpAidc\LabelPrinter\Label\Batch;
use PhpAidc\LabelPrinter\Label\Label;
use PhpAidc\LabelPrinter\Label\Element;
use PhpAidc\LabelPrinter\CompilerFactory;
use PhpAidc\LabelPrinter\Connector\NetworkConnector;

$batch = (new Batch())
    ->add(Label::create()->add(Element::textLine(168, 95, 'Hello!', 'Univers', 8)))
    ->add(Label::create()->add(Element::textLine(168, 95, 'Bye!', 'Univers', 8)))
;

(new Printer(new NetworkConnector('192.168.x.x'), CompilerFactory::fingerprint()))->print($label);
```

License
-------

[](#license)

The PhpAidc LabelPrinter is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

> Some ideas taken from [mike42/escpos-php](https://github.com/mike42/escpos-php).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~168 days

Total

4

Last Release

1643d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2151259?v=4)[JhaoDa](/maintainers/jhaoda)[@jhaoda](https://github.com/jhaoda)

---

Top Contributors

[![jhaoda](https://avatars.githubusercontent.com/u/2151259?v=4)](https://github.com/jhaoda "jhaoda (28 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

aidcfingerprinthoneywellintermecphp7printertsctspltspl2printerbarcodeprintposlabelFingerprintwmstscHoneywellDirectProtocolTSPLTSPL2Intermecaidc

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/php-aidc-label-printer/health.svg)

```
[![Health](https://phpackages.com/badges/php-aidc-label-printer/health.svg)](https://phpackages.com/packages/php-aidc-label-printer)
```

###  Alternatives

[mike42/escpos-php

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

2.7k1.9M22](/packages/mike42-escpos-php)[qiniu/php-sdk

Qiniu Resource (Cloud) Storage SDK for PHP

8483.0M240](/packages/qiniu-php-sdk)[czim/file-handling

File Handling Helper

15803.8k1](/packages/czim-file-handling)[ramytalal/label-printer

An implementation of the Brother label printer API.

6641.8k](/packages/ramytalal-label-printer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
