templated-uri-bundle

UNIX name Owner Status
templated-uri-bundle 7x stable
Version Compatible with
N/A N/A
Interested in this extension? Sponsor it!

Hautelook Templated URI Bundle

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:

// 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*}

No news yet.

This project has no reviews yet. Be the first one to review it!

No forum messages yet.