- What is hoa/zformat and what does it do?
- Hoa\Zformat is a standalone PHP library providing a lightweight, extensible string-formatting language inspired by .NET-style placeholders. It lets you interpolate typed and named values into template strings, which historically helped with structured output and localization. It is a leaf utility built in Hoa's house style alongside hoa/consistency, hoa/exception and the hoa:// protocol wrapper, and it has no architectural role in a Laravel application.
- Is hoa/zformat compatible with Laravel?
- Mechanically yes: you can install it with Composer, it uses the Hoa\Zformat namespace, and collision risk is low. But there is no service provider, facade or Laravel integration, and every layer where you might use it already has a first-party answer in sprintf, strtr, Str::replaceArray or the translator's :placeholder replacement. It is a replacement candidate, not a complement, so there is no seam in a Laravel app where adding it improves the design.
- Does hoa/zformat support PHP 8?
- There is no documented PHP 8.x compatibility work. The last release was 2017-01-10, the repository is archived, and no maintainer is doing triage or backporting. The string handling was written in the PHP 5.5–7.0 era, which is exactly the code most exposed to 8.x deprecations such as removed ${var} interpolation, implicit nullable parameters, dynamic properties and deprecated regex modifiers. If you are forced to keep it, run it on 8.2, 8.3 and 8.4 with error_reporting(E_ALL) before trusting it.
- Is hoa/zformat still maintained?
- No. The last release shipped on 2017-01-10, the GitHub repository is archived, and there is no maintainer, no security triage and no CVE response process. Its transitive Hoa dependencies are frozen artifacts with no owner, and the package has roughly 257 stars and zero dependents, so there is no peer validation or community pressure to keep it working. Any fix you need becomes your own fork.
- How do I install hoa/zformat with Composer?
- Run composer require hoa/zformat and reference the Hoa\Zformat namespace. The friction is not the install command but what comes with it: Hoa's own autoloader bootstrap, hoa:// stream wrapper registration, and archived transitive dependencies hoa/consistency and hoa/exception. Whether that boot-time global registration coexists cleanly with Composer 2 optimized or --classmap-authoritative autoloaders is an empirical question rather than a documented guarantee, so budget a half-day spike and flag the registration in code review.
- What are the best alternatives to hoa/zformat in Laravel?
- Use native sprintf or vsprintf for positional and typed tokens, strtr for named tokens, Str::replaceArray and Str::replaceFirst for ordered substitution, and the translator's :name replacement for user-facing strings. If you truly need typed conversion with named fallbacks, that is roughly a 50-line internal Formatter helper that is fully typed, IDE-navigable, static-analysis-clean and owned by your team. The make-versus-buy call here clearly resolves to make.
- Can hoa/zformat be used for Laravel translation and localization placeholders?
- Laravel's translator already performs :placeholder replacement, so routing localization through Zformat duplicates a first-party answer. A custom format parser also turns malformed templates into thrown Hoa exceptions rather than graceful degradation, which is a poor fit for user-facing strings. Keep translation inside the framework and reserve any custom formatter for internal, non-user-controlled templates.
- Is hoa/zformat safe to use with user-supplied format strings?
- Treat it as unsafe. A custom placeholder language is a hand-rolled grammar, and malformed or user-controlled templates produce thrown Hoa\Exceptions instead of graceful degradation, converting a formatting bug into a 500 on a user-facing path. If format strings can ever be constructed from user input, you are dealing with a denial-of-service and error-handling question, not a formatting question.
- Does hoa/zformat register a stream wrapper or interfere with Composer autoloading?
- Yes. It ships with the hoa:// protocol wrapper and Hoa's own autoloader bootstrap, meaning global-state registration at boot. Whether that coexists cleanly with Composer 2's optimized and --classmap-authoritative autoloaders is not documented, so prove the wiring in a spike before committing. Treat the boot-time registration as a code-review flag.
- We already depend on hoa/zformat. How do we migrate off it?
- Start with inventory: run composer why hoa/zformat, grep for Hoa\Zformat, enumerate call sites, and classify each by the feature actually used, such as typed placeholders, named arguments, defaults or escaping. Then write golden tests that pin the current output for every call site and replace the implementation with sprintf, strtr, Str::replaceArray or a small internal helper, diffing against the pinned output. If a Hoa dependency such as Ruler, Event or Stream is what drags Zformat in transitively, the conversation shifts from adopt to contain, with a named risk acceptor and a review date.