2017 © Pedro Peláez
 

symfony-bundle router-decoration-bundle

Symfony RequestumRouterDecorationBundle

image

requestum/router-decoration-bundle

Symfony RequestumRouterDecorationBundle

  • Monday, July 25, 2016
  • by admins@requestum.com
  • Repository
  • 5 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

requestum/router-decoration-bundle

A Symfony Bundle created on July 19, 2016, 3:27 pm., (*1)

Bundle provides the ability to automatically replace the router parameters values to predefined system values., (*2)

Installation:

Via Composer, (*3)

composer require requestum/router-decoration-bundle

Add new Requestum\RouterDecorationBundle\RequestumRouterDecorationBundle() to you app/AppKernel.php., (*4)

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Requestum\RouterDecorationBundle\RequestumRouterDecorationBundle(),
        );

        // ...
    }

    // ...
}

Configuration:

To configure bundle in your own application you must add code in special format to your configuration file:, (*5)

# Requestum Router Decorator Configuration
requestum_router_decoration:
      parameters_mapper:
            pattern: mask
            map:
                  <route mask 1>:
                        <parameter name 1>:
                            <route value 1>: <system value 1>
                            ...
                            <route value n>: <system value n>
                        ...
                        <parameter name n>
                  ...
                  <route mask n>:

Documentation:

Bundle uses pattern mask input by default if pattern not specified in configuration file. If you want use regular expressions in configuration of route mask, you must typo 'regexp' in pattern option., (*6)

If you using pattern mask, you must follow this example:, (*7)

...
    pattern: mask
    map:
          #Route names 'route_name_' that has any sufix
          route_name_*:
                ...

          #Route names 'route_name_' that has any prefix
          *_route_name:
                ...

          #Route names that has 'route_' prefix and '_name' sufix                    
          route_*_name:
                ...

If you using pattern regexp, you only need write some regular expression like this:, (*8)

...
    pattern: regexp
    map:
          #Route names 'route_name_' that has any sufix
          /route_name_.*/:
                ...

          #Route names 'route_name_' that has any prefix
          /.*_route_name/:
                ...

          #Route names that has 'route_' prefix and '_name' sufix                    
          /route_.*_name/:
                ...

Advanced:

If you want to define some custom decorator for parameter mapping, you only need define you own service and taged them by requestum.router_decorator tag, but your own service must extend AbstractRouterDecorator., (*9)

If you want use your own mapping strategy, you only need to define new service and type them identifier in pattern option, but your own strategy must implements PatternStrategyInterface., (*10)

The Versions

25/07 2016

dev-master

9999999-dev

Symfony RequestumRouterDecorationBundle

  Sources   Download

The Requires

 

by Sergey Stavichenko
by Alexey Bychek

router