Download the PHP package twirelab/laravel-router without Composer
On this page you can find all versions of the php package twirelab/laravel-router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-router
Laravel Router
Attention! This package is not suitable for use in production.
The router is a new way of defining routes in the Laravel framework using annotations.
Requirements
- Laravel 8 or above.
- PHP 8.1 or above.
Installation
-
Install the package via composer
- Done! It was simple.
Usage
Laravel 10 and below
In the place where you define routes (ex. RouteServiceProvider) you need to call a Loader class from the package.
The default class:
Change to this:
From now, the Loader automatically imports Controllers from selected directories.
If you prefer, select controllers manually all the time. You can use the loadControllers method.
If don't want to use a group function (for example: you don't need a "main" group like API or Web) you can use rest of functions directly.
Laravel 11 and below
In the place where you define routes (ex. api.php or web.php) you need to call a Loader class from the package.
For example:
Controller
If you want routes to load properly, you need to add the annotate to the controller class.
The "route" annotation works as a group function in Laravel.
Available options for Router annotation:
- as - the name of a group,
- prefix - the prefix of a group,
- domain - the domain of a group,
- middlewares - the list of middlewares of a group,
Now, we can define the first route for the method.
Our route: GET - / - index > FirstController@index
Available options for Method annotation:
- uri - the address URL for a route,
- method - the method of a route,
- name - the name of a route,
- middlewares - the list of middlewares of a route,
- where - the list of where's of a route,
Contributing
Feel free to add a new issue! Please describe in detail your problem or idea and I will check your issue and respond - Thank you!
All versions of laravel-router with dependencies
illuminate/support Version ^8.0 | ^9.0 | ^10.0 | ^11.0
illuminate/routing Version ^8.0 | ^9.0 | ^10.0 | ^11.0