hautelook / templated-uri-router
Symfony URL generator that provides an RFC-6570-compatible router.
Installs: 1 757 490
Dependents: 3
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: >=8.0.2
- symfony/routing: ^6.0
Requires (Dev)
- phpunit/phpunit: ^9.0
README
Symfony URL generator that provides an RFC-6570-compatible router.
Currently, it is extremely naive and incomplete. However, it does what we need it to do. Contributions are welcome.
Installation
Run the following command (assuming you have composer.phar or composer binary installed), or
require hautelook/templated-uri-router
to your composer.json
and run composer install
:
$ composer require hautelook/templated-uri-router
Usage
# routing.yml hautelook_demo_route: pattern: /demo
use Hautelook\TemplatedUriRouter\Routing\Generator\Rfc6570Generator as TemplateGenerator; $templateGenerator = new TemplateGenerator($routes, $context); $templatedUri = $templateGenerator->generate('hautelook_demo_route', array( 'page' => '{page}', 'sort' => array('{sort}'), 'filter' => array('{filter}'), ));
This will produce a link similar to:
/demo{?page,sort*,filter*}
Bundle
The Symfony bundle lives at https://github.com/hautelook/TemplatedUriBundle.