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

TemplatedUriBundle

by hautelook

Expose the hautelook/TemplatedUriRouter in a symfony application

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*}
MIT License

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:  []
  • Merge pull request #33 from goetas/check-compiled-router
    By web-flow, 10 months ago
  • use a more precise check to see if Rfc6570Generator is a compiled url generator
    By goetas, 10 months ago
  • Merge pull request #32 from goetas/router-detect
    By web-flow, 11 months ago
  • better symfony 5 router type detection
    By goetas, 11 months ago
  • Merge pull request #31 from webhdx/sf5_compatiblity
    By web-flow, 1 year ago
  • Increased PHP memory limit
    By webhdx, 1 year ago
  • Added Symfony 5 compatibility
    By webhdx, 1 year ago
  • Merge pull request #29 from goetas/sf5
    By web-flow, 1 year ago
  • allow symfony 5
    By goetas, 1 year ago
  • Merge pull request #27 from goetas/fix-ci
    By web-flow, 1 year ago
  • use dist: precise for old php versions
    By goetas, 1 year ago
  • Merge pull request #26 from adamwojs/fixed_deprecated_tree_builder_root_deprecation
    By web-flow, 1 year ago
  • Fixed deprecated TreeBuilder::root method call in SF 4
    By adamwojs, 1 year ago
  • changelog for 3.0.0
    By goetas, 2 years ago
  • update example that follows TemplatedUriRouter v3
    By web-flow, 2 years ago
  • Merge pull request #23 from goetas/v3
    By web-flow, 2 years ago
  • increase branch alias
    By goetas, 2 years ago
  • allow templated-uri-router v3
    By goetas, 2 years ago
  • add changelog
    By goetas, 2 years ago
  • Add back missing license
    By goetas, 2 years ago
  • Merge pull request #22 from hautelook/sf34-fix
    By web-flow, 2 years ago
  • update readme
    By goetas, 2 years ago
  • compile the container so the compiler pass is invoked
    By goetas, 2 years ago
  • improve compatibility with symfony lower than 4.0
    By goetas, 2 years ago
  • remove comment block
    By goetas, 2 years ago
  • remove dev constraint from composer deps
    By goetas, 2 years ago
  • Merge pull request #21 from goetas/sf4
    By web-flow, 2 years ago
  • use sf 2.8 instead of 2.1
    By goetas, 2 years ago
  • try sem ver
    By goetas, 2 years ago
  • drop 5.3 support
    By goetas, 2 years ago