- What does ibexa/templated-uri-router actually do?
- It is an RFC-6570 URI template generator built on Symfony's routing component, so instead of resolving concrete values it emits placeholder expressions such as /demo{?page,sort*,filter*}. It is a fork of hautelook/templated-uri-router maintained by Ibexa and is deliberately small and easy to extend. It generates templated links only; it does not match or dispatch incoming requests.
- Does ibexa/templated-uri-router work with Laravel?
- Only indirectly. The package is a Symfony UrlGenerator, not a Laravel package, so it ships no service provider, facade, config file or route macro. You can require it in a Laravel application and wrap it yourself, but Laravel's router and url() helper will not use it automatically. In practice that means Laravel 11 or later on PHP 8.2+ when using version 6.
- How do I install ibexa/templated-uri-router?
- Run composer require ibexa/templated-uri-router. There is no Laravel auto-discovery, so nothing is registered for you after installation. Version 6.x requires PHP 8.2 or newer and symfony/routing 7.4 or 8.1, which Composer enforces at install time.
- Which Laravel, Symfony and PHP versions are supported?
- Version 6.0.0 requires symfony/routing ^7.4 || ^8.1, which implies PHP 8.2+ and PHP 8.4+ if you adopt Symfony 8. Laravel 11 resolves Symfony 7.4 and works, and Laravel 12 is viable as well. Laravel 10 pins symfony/routing ^6.2, so it is excluded unless you stay on the 5.x line of this package.
- How do I generate a templated URL like /demo{?page,sort*,filter*}?
- Instantiate Hautelook\TemplatedUriRouter\Routing\Generator\Rfc6570Generator with a RouteCollection and a RequestContext, then call generate() with template strings as parameter values. Passing page as '{page}' and sort as array('{sort}') produces /demo{?page,sort*,filter*}, where the array values become the explode-modifier placeholders marked with an asterisk. Keep the placeholders as literal strings; the generator copies them into the query expression instead of substituting values.
- Can it match incoming templated URIs or resolve placeholders at runtime?
- No. The package is generation-only: there is no matcher, no route compiler for templates, and no middleware that expands placeholders on incoming requests. If you need to accept a URL like /demo?page=2&sort=name and turn it back into parameters, that parsing logic is your code. Laravel's own router remains responsible for matching and dispatching actual requests.
- How do I integrate it with Laravel's router and closure-based routes?
- Build or convert a Symfony RouteCollection from your Laravel route definitions, create a RequestContext from the current request, and wrap the generator in a small service provider, facade or helper. Laravel closure routes and fluent definitions must be translated into the array or YAML style route definitions the Symfony collection expects. Keep validation of malformed templates and unexpected parameter arrays in your wrapper, since the package does none.
- Is ibexa/templated-uri-router production ready and well maintained?
- It is a small, stable and essentially frozen codebase; the upstream README describes it as extremely naive and incomplete, which is accurate. The 6.0.0 release appears to be a constraint-widening major bump with a CI workflow change rather than feature work, and test coverage upstream is thin. Diff the 5.0.0 to 6.0.0 tags before pinning, and write your own tests for nested templates, reserved characters and empty parameters.
- What are the alternatives to templated URI routing in Laravel?
- For simple cases, plain string concatenation, http_build_query or Laravel's Str helpers cover optional query parameters without any dependency. If you want full RFC-6570 support independent of Symfony routing, dedicated URI template libraries such as guzzlehttp/uri-template are lighter to wire into a Laravel service provider. This package makes sense mainly when you already have Symfony RouteCollection definitions and want templated output from them.
- Does it replace Laravel's url() helper, and what is the performance impact?
- It does not replace url(); it complements the router by producing templates rather than concrete links. Generation is in-memory string assembly with no I/O, so per-call cost is comparable to native URL generation, but array parameters expand to multiple placeholders and nothing is cached. Benchmark against url() at your expected link volume, especially on pages that emit hundreds of faceted-search or pagination links.