Skip to content

mercurio-sistemi/TemplatedUriRouter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hautelook Templated URI Router

Symfony2 UrlGenerator that provides a RFC-6570 compatible router and URL Generator. Currently it is extremely naive, and incomplete. However, it does what we need it to do. Contributions are welcome.

Build Status

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 ~1.0"

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%5B%5D*,filter%5B%5D*}

Bundle

The symfony2 bundle lives at https://github.com/hautelook/TemplatedUriBundle.

About

Symfony2 RFC-6570 compatible router and URL Generator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%