Download the PHP package raindrop/routing-bundle without Composer
On this page you can find all versions of the php package raindrop/routing-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package routing-bundle
Raindrop Routing Bundle
This bundle is based on routing extra bundle for symfony-cmf (available at https://github.com/symfony-cmf/RoutingBundle). If you want to use PHPCR ODM, the symfony cmf routing extra bundle features more routing options. This is the ORM simplified version.
It replaces symfony router with a chain router, appends standard router and dynamic router to it (as specified into configuration). This allows you to save routes to database and continue using symfony standard routing.
All routers attached to chain router can be sorted using a priority key specified into configuration.
This bundle also offers the option to link the route to any other entity, this object will be served when controller method gets invoked, as parameter.
INSTALLATION:
First add the dependency to your composer.json
file:
"require": {
...
"raindrop/routing-bundle": "dev-master"
},
Then install the bundle with the command:
php composer.phar update
Enable the bundle in your application kernel:
Now the bundle is enabled.
CONFIGURATION:
Add following lines to app/config/config.yml
:
and
This will instruct the configuration to detach symfony router, attach chain router and append symfony standard router and the dynamic one.
The dynamic router fetches and stores routes from/to database using Doctrine ORM.
USAGE:
Bind routes to controllers:
A get request with /path/to/my/route
will now point to AcmeDemoBundle:Default:index
Into twig templates:
{{ url('my_route') }}
This will resolve name to url as defined into database.
Bind routes to controller as service:
Bind routes to controller with target object(s):
In this case the controller must implement method signature as following. The parameter name 'content' is mandatory.
Content will be passed to the controller when invoked.
When the reference field is 'id', it can be omitted as following.
This will retrieve Acme\DemoBundle\Entity\SampleEntity entity record with id 1.
You can also reference objects using other database fields:
Or use the setter method:
To bind a collection use the following syntax:
All Acme\DemoBundle\Entity\Route with locale 'en' will be returned.
To use the setter pass an array and the other parameters:
parameter can be implicit: . It will be retrieved from first array element, as well as class type.
Bind routes to other routes:
To obtain this, point the redirecting route to the target one and set the redirection controller (or another one that does the job). Optionally set 301 status code (default is 302) with 'permanent' property.
or
Bind routes to external uri:
The target entity must implement Raindrop\RoutingBundle\Routing\Base\ExternalRouteInterface methods.
LIMITATIONS:
Routes path have a maximum length of 255 characters.
All versions of routing-bundle with dependencies
symfony/monolog-bundle Version >=2.1
doctrine/doctrine-bundle Version ^2.4