ibexa / templated-uri-bundle
Fork of hautelook/templated-uri-bundle. Symfony2 Bundle that provides a RFC-6570 compatible router and URL Generator.
Installs: 829 637
Dependents: 2
Suggesters: 0
Security: 0
Stars: 2
Watchers: 11
Forks: 0
Type:symfony-bundle
Requires
- php: ^5.4|^7.0|^8.0
- ibexa/templated-uri-router: ^2.0|^3.0
- symfony/framework-bundle: ^2.8.50 || ^3.4.26 || ^4.1.12 || ^4.2.7 || ^5.0
Requires (Dev)
- phpunit/phpunit: ^4.8.36 || ^5.6.3 || ^6.0 || ^7.0
Replaces
- hautelook/templated-uri-bundle: v3.3.2.2
README
Fork of hautelook/templated-uri-bundle
. Symfony Bundle for the https://github.com/hautelook/TemplatedUriRouter
library.
hautelook/TemplatedUriRouter
provides a RFC-6570 compatible
Symfony router and URL Generator.
Installation
Assuming you have installed composer, run the following command:
$ composer require ibexa/templated-uri-bundle
Now add the bundle to your Kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Hautelook\TemplatedUriBundle\HautelookTemplatedUriBundle(), // ... ); }
If you are using Symfony Flex, this bundle is added automatically to your bundles.php
file.
Usage
The bundle exposes a router service (hautelook.router.template
) that will generate RFC-6570 compliant URLs.
Here is a sample on how you could use it:
$templateLink = $container->get('hautelook.router.template')->generate('hautelook_demo_route', array( 'page' => '{page}', 'sort' => array('{sort}'), 'filter' => array('{filter}'), ) );
This will produce a link similar to:
/demo?{&page}{&sort*}{&filter*}