Developed with love by KnpLabs Hire us for your project!
40

TemplatedUriBundle

by hautelook

Expose the hautelook/TemplatedUriRouter in a symfony application

Hautelook Templated URI Bundle

Symfony2 Bundle for the https://github.com/hautelook/TemplatedUriRouter
library.

Build Status
SensioLabsInsight

Installation

Run the following command (assuming you have installed composer.phar or composer binary),
or add to your composer.json and run composer install:

$ composer require "hautelook/templated-uri-bundle ~1.0"

Now add the bundle to your Kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Hautelook\TemplatedUriBundle\HautelookTemplatedUriBundle(),
        // ...
    );
}

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 = $this->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%5B%5D*}{&filter%5B%5D*}
Copyright (c) 2012 Hautelook

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
hautelook_templated_uri:  []
  • Add Insights Badge
    By baldurrensch, 2 years ago
  • Fix .gitignore
    By baldurrensch, 2 years ago
  • Merge pull request #13 from Nyholm/patch-1
    By baldurrensch, 2 years ago
  • Added PHP 5.6, 5.5 and HHVM to travis.yml
    By Nyholm, 2 years ago
  • Update for 2.0 lib
    By adrienbrault, 2 years ago
  • Update readme
    By adrienbrault, 3 years ago
  • Merge pull request #10 from willdurand/router-lib
    By adrienbrault, 3 years ago
  • Switch to stable version of TemplatedUri
    By willdurand, 3 years ago
  • Add branch alias (composer)
    By willdurand, 3 years ago
  • Rename Hateoas alias from templated to templated_uri
    By willdurand, 3 years ago
  • Tweak README
    By willdurand, 3 years ago
  • Use Hautelook TemplatedUriRouter lib
    By willdurand, 3 years ago
  • Merge pull request #9 from baldurrensch/fix_composer
    By baldurrensch, 3 years ago
  • Fix composer
    By baldurrensch, 3 years ago
  • Merge pull request #7 from adrienbrault/bazinga-hateoas
    By baldurrensch, 3 years ago
  • Add BazingaHateoasBundle tag
    By adrienbrault, 3 years ago
  • Merge pull request #3 from baldurrensch/braces
    By baldurrensch, 4 years ago
  • Fixed braces that should not be encoded
    By baldurrensch, 4 years ago
  • Merge pull request #2 from baldurrensch/add_fsc_tag
    By baldurrensch, 4 years ago
  • Added FSC Hateoas bundle tag
    By baldurrensch, 4 years ago
  • Updated for Symfony 2.2
    By baldurrensch, 4 years ago
  • CS fixes
    By baldurrensch, 4 years ago
  • Merge pull request #1 from adrienbrault/fixes
    By baldurrensch, 4 years ago
  • Merge pull request #1 from baldurrensch/fixes
    By adrienbrault, 4 years ago
  • Fixed unit tests
    By baldurrensch, 4 years ago
  • Write sexier tests
    By adrienbrault, 4 years ago
  • Improve gitignore + travis/phpunit
    By adrienbrault, 4 years ago
  • Remove Component namespace
    By adrienbrault, 4 years ago
  • Update composer.json
    By baldurrensch, 4 years ago
  • Update composer.json
    By baldurrensch, 4 years ago