dev-master
9999999-devSymfony RequestumRouterDecorationBundle
The Requires
by Artem Lopata
by Sergey Stavichenko
by Alexey Bychek
router
Symfony RequestumRouterDecorationBundle
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)
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(), ); // ... } // ... }
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>:
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/: ...
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)
Symfony RequestumRouterDecorationBundle
router