{"id":46869022,"url":"https://github.com/andersonls/zpl","last_synced_at":"2026-03-10T19:31:04.362Z","repository":{"id":53756305,"uuid":"75829932","full_name":"andersonls/zpl","owner":"andersonls","description":"This library is a php wrapper for the ZPL Programming Language.","archived":false,"fork":false,"pushed_at":"2026-03-09T16:45:52.000Z","size":165,"stargazers_count":34,"open_issues_count":1,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-03-09T18:07:47.003Z","etag":null,"topics":["php-wrapper","zpl","zpl-programming-language"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andersonls.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-12-07T11:33:14.000Z","updated_at":"2026-03-09T16:40:05.000Z","dependencies_parsed_at":"2025-10-24T22:16:10.247Z","dependency_job_id":"81316887-8793-41fb-a053-41655c926cd1","html_url":"https://github.com/andersonls/zpl","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/andersonls/zpl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersonls%2Fzpl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersonls%2Fzpl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersonls%2Fzpl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersonls%2Fzpl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andersonls","download_url":"https://codeload.github.com/andersonls/zpl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersonls%2Fzpl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30350020,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php-wrapper","zpl","zpl-programming-language"],"created_at":"2026-03-10T19:31:03.900Z","updated_at":"2026-03-10T19:31:04.351Z","avatar_url":"https://github.com/andersonls.png","language":"PHP","readme":"## This library is a php wrapper for the ZPL Programming Language.\n---\n## Installation:\n\n```bash\ncomposer require andersonls/zpl\n```\n\n## How to use\n\nBelow are concise examples showing common (simple) and more advanced usages of the library.\n\nSimple usage (create a label with one cell and print it):\n\n```php\n\u003c?php\nrequire __DIR__ . '/vendor/autoload.php';\n\n// Use millimeters for coordinates and dimensions\nuse Zpl\\Enums\\Unit;\nuse Zpl\\Enums\\Align;\n$driver = new \\Zpl\\ZplBuilder(Unit::MM);\n\n// Set encoding (optional)\n$driver-\u003esetEncoding(28);\n\n$driver-\u003esetFont('0', 16);\n$driver-\u003esetXY(0, 0);\n$driver-\u003edrawCell(100, 10, 'Hello World', true, true, Align::CENTER);\n\n$zpl = $driver-\u003etoZpl();\n\n\\Zpl\\Printer::printer('192.168.1.1')-\u003esend($zpl);\n```\n\nAdvanced usage (multiple elements, barcodes, QR codes, graphics, pages and raw commands):\n\n```php\n\u003c?php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse Zpl\\Enums\\Unit;\n$driver = new \\Zpl\\ZplBuilder(Unit::MM);\n$driver-\u003esetFontMapper(new \\Zpl\\Fonts\\Generic());\n$driver-\u003esetDpi(300); // change printer DPI when needed\n\n// Draw shapes\n$driver-\u003edrawRect(5, 5, 50, 30);\n$driver-\u003edrawCircle(60, 5, 25);\n\n// Text with explicit coordinates\nuse Zpl\\Enums\\Orientation;\n$driver-\u003edrawText(5, 40, 'Product: ABC-123', Orientation::NORMAL);\n\n// Code 128 barcode (x, y, height, data, print human-readable?)\n$driver-\u003edrawCode128(5, 50, 20, 'ABC123456789', true);\n\n// QR Code (x, y, data, module size)\n$driver-\u003edrawQrCode(50, 50, 'https://example.com/product/ABC-123', 6);\n\n// Add an image/graphic. width is optional and will scale the graphic field in dots\n$driver-\u003edrawGraphic(120, 10, __DIR__ . '/logo.png', 200);\n\n// Add custom/pre/post raw commands (you can use ^XA, ^XZ and any other ZPL commands)\n$driver-\u003eaddPreCommand('^LH0,0'); // set label home\n$driver-\u003eaddPostCommand('^PQ1');  // print quantity 1\n\n// New page (adds a new label) - useful if you want to print multiple labels in one ZPL payload\n$driver-\u003enewPage();\n$driver-\u003edrawText(5, 5, 'Second label');\n\n// You can call arbitrary ZPL commands using method-like calls (dynamic): CF is same as ^CF\n$driver-\u003eCF('A', 30); // ^CFA,30  (be careful with arguments and expected format)\n\n\\Zpl\\Printer::printer('192.168.1.100')-\u003esend($driver-\u003etoZpl());\n```\n\n## Macros\n\nYou can extend the ZplBuilder with custom macros to add reusable commands or behaviors. Macros are registered using the `macro()` method and can be called as if they were native methods.\n\n### Registering a Macro\n\n```php\n$builder = new \\Zpl\\ZplBuilder('mm');\n\\Zpl\\ZplBuilder::macro('drawCustomBox', function($x, $y, $w, $h) {\n    $this-\u003edrawRect($x, $y, $w, $h);\n    $this-\u003edrawText($x + 2, $y + 2, 'Custom');\n});\n```\n\n### Using a Macro\n\n```php\n$builder-\u003edrawCustomBox(10, 10, 50, 20);\n```\n\n### Notes\n- Macros have access to the builder instance via `$this`.\n- You can override existing methods, but use caution to avoid breaking core functionality.\n- Macros are useful for encapsulating label patterns, custom shapes, or repetitive tasks.\n\nNotes and tips\n\n- Units: the constructor accepts a Unit enum (for example: `Unit::MM` or `Unit::DOTS`). When using `Unit::MM`, coordinates are converted to printer dots using the configured DPI (default 203).\n- DPI: default resolution is 203 DPI. Use `setDpi()` to change it or `getDpi()` to read it.\n- Font mapping: use `setFontMapper()` to provide a mapper implementing `\\Zpl\\Fonts\\AbstractMapper` (the included `\\Zpl\\Fonts\\Generic` maps logical font ids to ZPL fonts).\n- Special characters: common control characters are converted to their ZPL-safe hex sequences automatically (see library mappings for details).\n- Debugging: write the ZPL to a file and inspect it or send it to a printer emulator before printing on physical media.\n\n## Donations\n\nIf this project helps you somehow, you can give me a cup of coffee :)\n\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/donate/?hosted_button_id=KCZB8TGG63Y7W)\n","funding_links":["https://www.paypal.com/donate/?hosted_button_id=KCZB8TGG63Y7W"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandersonls%2Fzpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandersonls%2Fzpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandersonls%2Fzpl/lists"}