PHPackages                             faerber/zpl-to-png - 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. faerber/zpl-to-png

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

faerber/zpl-to-png
==================

Convert ZPL to PNG using PHP

0.1.0(8mo ago)054↓81.3%MITPHPCI passing

Since Oct 26Pushed 7mo agoCompare

[ Source](https://github.com/benfaerber/zpl-to-png)[ Packagist](https://packagist.org/packages/faerber/zpl-to-png)[ RSS](/packages/faerber-zpl-to-png/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

ZPL to PNG 🦓 [![](https://camo.githubusercontent.com/3ca6f131e5b93bb74738ccf484353fa19757a0b3470858e824199006af18bf6d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666165726265722f7a706c2d746f2d706e67)](https://packagist.org/packages/faerber/zpl-to-png) [![](https://github.com/benfaerber/zpl-to-png/actions/workflows/tests.yml/badge.svg)](https://github.com/benfaerber/zpl-to-png/actions)
=============================================================================================================================================================================================================================================================================================================================================================================================================================

[](#zpl-to-png---------)

[![](https://camo.githubusercontent.com/9ca14e9af82864d96210f53b2a722a529f1e87c480928e41ababcd0a8fab7c04/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c25323031302d627269676874677265656e3f6c6f676f3d706870)](phpstan.neon)[![](https://camo.githubusercontent.com/b23a27c615b638f4e3c0a955390f3c94f24d105894dea929886bbfbbe1efc82f/68747470733a2f2f636f6465636f762e696f2f67682f62656e666165726265722f7a706c2d746f2d706e672f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/benfaerber/zpl-to-png)[![](https://camo.githubusercontent.com/a066039fd1950e0b9cbefe2db4b369d4787ec337bfb640c3dd135c5358664df9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f62656e666165726265722f7064662d746f2d7a706c3f636f6c6f723d79656c6c6f77677265656e)](LICENSE)

`stripey-horse`: A knock-off Zebra renderer. A PHP client for `stripey-horse` (a ZPL to PNG renderer).

[![Fedex Output](test_data/fedex_output.png)](test_data/fedex_output.png)

An example render of [fedex.zplbin](./test_data/fedex.zplbin).

Getting Started
---------------

[](#getting-started)

1. Install [`stripey-horse`](https://github.com/benfaerber/stripey-horse)
2. Locate your binary path: `which stripey-horse`

```
use Faerber\ZplToPng\StripeyHorseConfig;
use Faerber\ZplToPng\StripeyHorseClient;

// Your binary path
$binaryPath = "/home/user/go/stripey-horse";
$client = StripeyHorseClient::buildWithBinaryPath($binaryPath);
$config = StripeyHorseConfig::builder()
    ->labelPreset("6x4")
    ->rotation(90)
    ->build();

$imageData = $client->convertZplToRawImage($zplContent, $config);

file_put_contents("my_converted_image.png", $imageData);
```

Why?
----

[](#why)

The Labelary API is great, but it only allows 5 requests per second. This leads to constant errors and failures when generating labels at scale.

Sadly, there are no simple ways to pay for higher limits. You have to contact Labelary directly and negotiate a custom deal to self-host.

Benefits
--------

[](#benefits)

- **No rate limits** - render as many labels as you need
- **No external dependencies** - works completely offline
- **Cost effective** - hence "Stripey Horse" instead of "Zebra"
- **Near-perfect rendering** - comparable quality to Labelary
- **Accurate Barcode rendering** - able to render all sorts of industry barcodes for UPS, Fedex, etc.

Development
-----------

[](#development)

- **PEST Tests** - `composer test`
- **Code Coverage** - `composer test:coverage`
- **Check Formatting** - `composer cs:check`
- **Format** - `composer cs:fix`
- **Static analysis** - `composer phpstan`

This uses process communication, why no FFI?
--------------------------------------------

[](#this-uses-process-communication-why-no-ffi)

This was a tough design but I decided process communication was better for my use case (a PHP app needing to render ZPL files to PNGs and serve them to customers).

### Reasons

[](#reasons)

- FFI would require going Go -&gt; C -&gt; PHP
- The C wrapper code would require manual memory management
- The `.so` would have to be installed in the PHP env instead of just installing a simple binary
- FFI would connect PHP to this program. A crash would be fatal for PHP.
- FFI would have saved around 50ms invocation time, but for an app that takes 300ms to even render, not worth the trouble!
    - Other image generation tools like GhostScript used by Imagick use process communication also

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance61

Regular maintenance activity

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

252d ago

### Community

Maintainers

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

---

Top Contributors

[![benfaerber](https://avatars.githubusercontent.com/u/37051697?v=4)](https://github.com/benfaerber "benfaerber (49 commits)")

---

Tags

phpzebra-printerzpl

### Embed Badge

![Health badge](/badges/faerber-zpl-to-png/health.svg)

```
[![Health](https://phpackages.com/badges/faerber-zpl-to-png/health.svg)](https://phpackages.com/packages/faerber-zpl-to-png)
```

###  Alternatives

[gladcodes/keygen

A fluent PHP random key generator.

123804.0k2](/packages/gladcodes-keygen)[cayetanosoriano/hashids-bundle

Bundle for integration of hashids lib to the container

22168.0k](/packages/cayetanosoriano-hashids-bundle)

PHPackages © 2026

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