PHPackages                             surda/zebra - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. surda/zebra

ActiveLibrary[HTTP &amp; Networking](/categories/http)

surda/zebra
===========

Zebra client for network-connected Zebra label printers

v2.1.0(1y ago)011MITPHPPHP &gt;=8.0

Since Dec 16Pushed 1y ago1 watchersCompare

[ Source](https://github.com/surda/zebra)[ Packagist](https://packagist.org/packages/surda/zebra)[ Docs](http://surani.cz)[ RSS](/packages/surda-zebra/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (5)Used By (0)

[Zebra2](https://github.com/Zebra2/Zebra2) integration into Nette Framework.
============================================================================

[](#zebra2-integration-into-nette-framework)

[![Licence](https://camo.githubusercontent.com/a7d26a4feca597e687e04c25e6c7e7c1ff06ac0824fb8ab3d68ffde57cd40453/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73757264612f7a656272612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/surda/zebra)[![Latest stable](https://camo.githubusercontent.com/15a66e1b341cbc8e7faf4594e878424c85a75518b4e7075be21b13cdf8178428/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73757264612f7a656272612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/surda/zebra)[![PHPStan](https://camo.githubusercontent.com/441b5874ce4df0a2defc892979c96c46889b69cb32119d04f0b48626349f8bc9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/phpstan/phpstan)

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

[](#installation)

The recommended way to is via Composer:

```
composer require surda/zebra

```

### Basic using

[](#basic-using)

```
$client = new \Surda\Zebra\Client\Client(host: '192.168.0.100');
$client->send(zpl: '^XA.......^XZ');
```

### Using dispatcher

[](#using-dispatcher)

```
$label = new \Surda\Zebra\Label\DummyDataLabel();
$printer = new \Surda\Zebra\Printer\Printer(name: 'name', host: '192.168.0.100');
$dispatcher = new \Surda\Zebra\Dispatcher\Dispatcher();
$dispatcher->dispatch(label: $label, printer: $printer);
```

### Nette Latte template

[](#nette-latte-template)

OrderLabel.latte

```
^XA
^MMT
^PW400
^LL0200
^LS0
^BY2,3,51^FT20,80^B3N,N,,N,N^FD{$order->getNumber()}^FS
^FT260,75^A0N,50,50^FH\^FD{$order->getNumber()}^FS
^PQ{$quantity},0,1,Y
^XZ
```

OrderLabel.php

```
class OrderLabel implements \Surda\Zebra\Label\ILabel
{
    public function __construct(private Order $order)
    {
    }

    public function getData(): string
    {
        $template = new \Surda\Zebra\Template\Template(
            __DIR__ . '/OrderLabel.latte',
            [
                'order' => $this->order,
                'quantity' => 1,
            ]
        );
        return (new \Surda\Zebra\Label\TemplateLabel($template))->getData();
    }
}
```

OrderLabelFactory.php

```
interface OrderLabelFactory
{
    public function create(Order $order)): OrderLabel;
}
```

LabelPrintManager.php

```
class LabelPrintManager
{
    public function __construct(
        private \Surda\Zebra\Printer\IPrinter $printer,
        private \Surda\Zebra\Dispatcher\Dispatcher $dispatcher,
    )
    {
    }

    public function print(ILabel $label): void
    {
        try {
            $this->dispatcher->dispatch($label, $this->printer);
        } catch (DispatchException) {
            throw new \Surda\Zebra\PrintException();
        }
    }
}
```

config.neon

```
service:
    zebraPrinter:
        factory: \Surda\Zebra\Printer\Printer('name', '192.168.0.100', 9100)
        autowired: false
    - OrderLabelFactory
    - LabelPrintManager(@zebraPrinter)
```

Presenter

```
#[Inject]
public OrderLabelFactory $orderLabelFactory;

#[Inject]
public LabelPrintManager $labelPrintManager;

public function print() {
    $order = new Order();
    $label = $this->orderLabelFactory->create($order);
    $this->labelPrintManager->print($label);
}
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance47

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~286 days

Total

4

Last Release

389d ago

Major Versions

v1.0.1 → v2.0.02024-02-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/e8d497ef90ca9ed180419b5ab29857be10e88d0614cf01c94b0f2ab5094de45d?d=identicon)[surda](/maintainers/surda)

---

Top Contributors

[![surda](https://avatars.githubusercontent.com/u/588663?v=4)](https://github.com/surda "surda (5 commits)")

---

Tags

nettezebra

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/surda-zebra/health.svg)

```
[![Health](https://phpackages.com/badges/surda-zebra/health.svg)](https://phpackages.com/packages/surda-zebra)
```

###  Alternatives

[nette/http

🌐 Nette Http: abstraction for HTTP request, response and session. Provides careful data sanitization and utility for URL and cookies manipulation.

48819.2M541](/packages/nette-http)[nette/routing

Nette Routing: two-ways URL conversion

25712.0M22](/packages/nette-routing)[contributte/apitte

An opinionated and enjoyable API framework based on Nette Framework. Supporting content negotiation, debugging, middlewares, attributes and loving openapi/swagger.

641.3M3](/packages/contributte-apitte)[contributte/psr7-http-message

PSR-7 (HTTP Message Interface) to Nette Framework

222.9M8](/packages/contributte-psr7-http-message)[contributte/guzzlette

Guzzle integration into Nette Framework

291.2M3](/packages/contributte-guzzlette)[contributte/api

Powerful, documented, validated, built-in API to Nette Framework (@nette)

10684.3k](/packages/contributte-api)

PHPackages © 2026

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