phrity/util-interpolator
Lightweight PHP string interpolation helper. Replaces {key} tokens with values from an array/object, supports nested paths (default “.” separator, customizable), and can be used via Interpolator class or InterpolatorTrait. Uses Phrity Accessor/Transformer.
{user.name} with actual data)..env or config/ values) with nested structures like {database.connections.mysql.host}.{count} items → 3 items).str_replace chains) in favor of a consistent, reusable utility.{user.email}).User {id} failed login).Found {count} records).{user.address.city}) beyond simple key-value replacements.strtr or sprintf suffice).For Executives: "This lightweight Laravel package replaces manual string interpolation with a reliable, scalable utility—reducing bugs in dynamic content (emails, logs, APIs) while supporting nested data structures. It’s a drop-in solution that aligns with our tech stack (PHP 8.1+, Laravel) and future-proofs templating needs. Low maintenance risk due to MIT license and active development."
For Engineering: *"Pros:
str_replace chains with $interpolator->interpolate().{user.profile.settings.theme}) via path notation./ for JSON paths) or transformers (e.g., JSON decoding).Cons:
composer.json (minimal overhead).{key} syntax vs. existing patterns.Recommendation: Pilot in one high-impact area (e.g., email templates) to validate ROI before broader adoption."*
How can I help you explore Laravel packages today?