Expose the hautelook/TemplatedUriRouter in a symfony application
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
DependencyInjection
Resources/config
Tests
.gitignore Fix .gitignore Oct 22, 2014
.travis.yml use sf 2.8 instead of 2.1 Aug 3, 2018
CHANGELOG.md changelog for 3.0.0 Nov 30, 2018
HautelookTemplatedUriBundle.php fix resource type Jul 26, 2018
LICENSE Add back missing license Sep 21, 2018
README.md
composer.json increase branch alias Nov 23, 2018
phpunit.xml.dist Improve gitignore + travis/phpunit Nov 24, 2012

README.md

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.

Build Status SensioLabsInsight

Installation

Assuming you have installed composer, run the following command:

$ composer require hautelook/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*}