| Package Data | |
|---|---|
| Maintainer Username: | Clarence-pan |
| Maintainer Contact: | clarence-pan@foxmail.com (Clarence) |
| Package Create Date: | 2016-04-22 |
| Package Last Update: | 2016-04-22 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-12-10 03:13:27 |
| Package Statistics | |
|---|---|
| Total Downloads: | 14 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 10 |
| Total Watchers: | 1 |
| Total Forks: | 1 |
| Total Open Issues: | 0 |
With this library, you can easily add "module/controller/action" style routes for Laravel.
Suggest install it via composer:
composer require clarence/laravel-default-routes
Then, register the DefaultRouteProvider. For example, add \Clarence\LaravelDefaultRoutes\DefaultRouteProvider::class to the providers section in config/app.php.
// config/app.php
return [
//...
'providers' => [
//...
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Clarence\LaravelDefaultRoutes\DefaultRouteProvider::class, // add DefaultRouteProvider below the RouteServiceProvider
//...
],
//...
];
foo/bar will be mapped to \App\Http\Controllers\FooController@doGetBar by default.
Note:
\App\Http\Controllers\ is the namespace prefix of the controller. It can be configurated as laravel-default-routes.controller-prefix.FooController, Controller is the class name suffix. It can be configurated as laravel-default-routes.controller-suffix.doGetBar is the actual method to be executed. It is do + <HTTP_METHOD> + <action>. And it should be a public method. Otherwise a 404 or 405 HTTP error will be thrown.\App\Http\Controllers\FooController@doGetBar cannot be found, \App\Http\Controllers\Foo\BarController@doGetIndex will be tried.