Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Url Template Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy on URL templating. If any surface of the product lets a user or partner define an outbound URL with placeholders — webhook endpoints, integration callbacks, tracking/affiliate links, deep-link builders, configurable export destinations — you need a decision: hand-roll str_replace('{id}', $id, $url), adopt a library, or forbid templating entirely. This package is a candidate only for the "adopt a library" branch.
  • Whether to standardize on RFC 6570. Committing to RFC 6570 as the internal and external contract (rather than a bespoke {{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.
  • Customer-facing configurability as a feature. The unlock is letting customers configure URL patterns in a UI without writing code. That shifts support burden (bad templates, missing variables, encoding bugs) and requires a validation story: parse the template at save time, reject unexpandable ones, preview the expanded result. This package's parse step is what makes save-time validation possible.
  • Scope of the templating feature. Deciding whether to support the full RFC (levels 1–4: {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.
  • Dependency posture. Choosing a framework-agnostic, MIT-licensed utility over something that drags in a PSR-7/Guzzle stack is a lightweight architectural call, relevant if this ships inside a package or SDK rather than an app.
  • What it does not decide: it is a formatting primitive, not a roadmap driver. It should never appear as a strategic bet — only as an enabler inside a feature that already justified itself.

When to Consider This Package

Consider it when:

  • You need full RFC 6570 compliance, including operators, prefix modifiers ({var:3}), and explode ({list*}) — i.e., you are consuming templates authored by third parties, not just ones you wrote.
  • You need parse and expand, because you want to validate a template at configuration time and render it at execution time.
  • You want a framework-agnostic, MIT, small-surface library with no Laravel coupling and no PSR-7 baggage, e.g., embedded in a redistributable SDK.
  • Your team is comfortable with Innmind's functional/immutable style (innmind/immutable collections, value-object API) or you are willing to isolate it behind a single adapter class.

Look elsewhere when:

  • You only need {var} substitution. Write the helper; a dependency with 4 stars and 0 dependents is a worse trade than 40 lines you own.
  • Ecosystem support and battle-testing matter. 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.
  • You already ship Guzzle/PSR-7. Adding a second URI-templating implementation is duplication, not leverage.
  • You want Laravel-native behavior. Laravel routing, 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.
  • The codebase is idiomatic Laravel. Pulling a functional-style package in for one utility creates a style island that every future maintainer pays for.
  • You need guarantees. Zero dependents and single-maintainer status mean no community safety net; if you adopt, pin the version, wrap it, and own RFC-example contract tests yourself.

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.

How to Pitch It (Stakeholders)

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle