Download the PHP package faerber/zpl-to-png without Composer
On this page you can find all versions of the php package faerber/zpl-to-png. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download faerber/zpl-to-png
More information about faerber/zpl-to-png
Files in faerber/zpl-to-png
Package zpl-to-png
Short Description For this package there is no description available.
License
Informations about the package zpl-to-png
ZPL to PNG 🦓
stripey-horse: A knock-off Zebra renderer. A PHP client for stripey-horse (a ZPL to PNG renderer).
An example render of fedex.zplbin.
Getting Started
- Install
stripey-horse - Locate your binary path:
which stripey-horse
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
- 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
- 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 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
- FFI would require going Go -> C -> PHP
- The C wrapper code would require manual memory management
- The
.sowould 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