Download the PHP package nubox/laminas-router-attributes without Composer
On this page you can find all versions of the php package nubox/laminas-router-attributes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nubox/laminas-router-attributes
More information about nubox/laminas-router-attributes
Files in nubox/laminas-router-attributes
Package laminas-router-attributes
Short Description Use Symfony Route Attributes for Laminas Controller
License BSD-3-Clause
Informations about the package laminas-router-attributes
Using Symfony Route Attributes in Laminas Action Controller
This guide will walk you through on how to use Symfony Route Attributes in Laminas Action Controller in PHP 8.1.
Requirements
- PHP 8.1 or higher
Installation
Install the required packages via composer.
composer require nubox/laminas-router-attributes
Activate Plugin in our Laminas Application
Usage
You can start by creating a new action controller which we will annotate with Symfony's Route attributes instead of the laminas configuration.
In the example above, #[Route('/my-path', name: 'my_route_name')]
defines the path for the action and names the route.
That's all! You have successfully configured Symfony Route Attributes in your Laminas Action Controller.
Supported behavior from Symfony routes
- configuration via Attributes
path
-> domain route for methods or classesname
-> set up a name for the routecondition
-> for more complex conditions about your route (requiresymfony/expression-language
)methods
-> restrict the route to an explicit methodrequirments
-> Parameters Validation via RegExpinline-defaults
-> Inline default-settings (in combination with conditions, also)defaults
-> add default settings
Troubleshooting
If you run into any issue while trying to use Symfony Route attributes in your Laminas Action Controller, please refer to the respective Symfony and Laminas documentation.
- Symfony Documentation: https://symfony.com/doc/current/routing.html
- Laminas Documentation: https://docs.laminas.dev/laminas-mvc/
Should you encounter issues that are not documented, kindly log them in our issues tracker.
Happy Coding!
All versions of laminas-router-attributes with dependencies
symfony/config Version ^6.4 || ^7.0
symfony/routing Version ^6.4 || ^7.0
symfony/http-foundation Version ^6.4 || ^7.0
laminas/laminas-router Version ^3.0