innmind/url-template
A PHP implementation of RFC 6570 URI Templates for expanding URL templates with variables. Build type-safe URLs using simple and complex expressions, with a clean API that fits the Innmind ecosystem and simplifies dynamic link generation.
str_replace('{id}', $id, $url), adopt a library, or forbid templating entirely. This package is a candidate only for the "adopt a library" branch.{{var}} or :var convention) buys interop with HAL, JSON Hyper-Schema, OpenAPI callbacks, and third-party specs that already speak URI Templates. That is a contract decision with long-lived API/UX consequences — it is the main product-level call this package touches.{var}, {+var}, {#var}, {?var}, {&var}, {.var}, {/var}, {;var}, plus :prefix and * explode modifiers) or only simple substitution is a genuine scope/cost tradeoff. Full compliance is where a library earns its keep; a subset is a 40-line helper.Consider it when:
{var:3}), and explode ({list*}) — i.e., you are consuming templates authored by third parties, not just ones you wrote.innmind/immutable collections, value-object API) or you are willing to isolate it behind a single adapter class.Look elsewhere when:
{var} substitution. Write the helper; a dependency with 4 stars and 0 dependents is a worse trade than 40 lines you own.rize/uri-template and guzzlehttp/uri-template are the de facto PHP choices with real-world usage; for a payment-adjacent or high-volume path, prefer the dull, widely-deployed option.URL::to, route-model binding, and signed URLs already cover most "build a URL" needs, and none of them want an immutable-collection API in the call path.Note the maintenance signal is genuinely mixed: a recent release (2026-08-09) suggests someone is home, but adoption is effectively nil — treat it as an unproven utility, not a supported platform component.
For executives (one paragraph): This is a small, MIT-licensed PHP utility that expands RFC 6570 URL templates — the standard placeholder syntax for URLs. It unblocks the kind of feature where customers configure their own webhook or callback URLs without writing code, and it lets us validate those templates before we save them. Cost is effectively zero, license is permissive, and the risk is containable: we wrap it behind our own interface and contract-test it, so replacing it later is a one-file change. It is not a strategic bet and should not consume roadmap attention — it is plumbing behind a feature that has to justify itself on its own merits.
For engineering (short brief): RFC 6570 has more edge cases than it looks — operator semantics, prefix truncation, list/map explode, encoding rules per operator — and those are exactly the bugs you don't want to rediscover in production. This package covers parse and expansion in a small, framework-agnostic surface, which is the right shape if we need compliance rather than string interpolation. Two caveats: the API is functional and immutable-style, which is foreign to our Laravel conventions, so confine it to one adapter class behind an interface like UrlTemplateExpander; and with 4 stars and 0 dependents there's no crowd to catch regressions, so we pin the version and test against the RFC's published examples. If the requirement is only simple {var} substitution, we should skip it and ship a helper; if it's full compliance, this is a reasonable option but rize/uri-template is the safer default unless we specifically want to avoid its footprint.
How can I help you explore Laravel packages today?