ahmmmmad11/inhanced-routing
最新稳定版本:1.0.0
Composer 安装命令:
composer require ahmmmmad11/inhanced-routing
包简介
alternative laravel routing package
README 文档
README
extends Laravel routing package to add more functionality, For this version we provide the ability to allow multiple explicit route binding fields.
Installation
composer required ahmmmmad11/enhanced-routing
Now open config/app.php and add the service provider to your providers array.
'providers' => [
/*
* Package Service Providers...
*/
\Ahmmmmad11\Routing\RoutingServiceProvider::class,
]
then go to app/Http/Kernal and add the follwing code
//import Router class and Application Interface
use Ahmmmmad11\Routing\Router;
use Illuminate\Contracts\Foundation\Application;
// add this constructer inside Kernal class
public function __construct(Application $app, Router $router)
{
$this->app = $app;
$this->router = $router;
$this->syncMiddlewareToRouter();
}
usage
if you successfully intalled the package now you can bind multiple fields to the route
Route::get('users/{user:email,username,id}', function(User $user) {
return $user;
});
now you can access this route in many ways, like:
// http://127.0.0.1:8000/users/1
or
// http://127.0.0.1:8000/users/firstuser@example.com
or
// http://127.0.0.1:8000/users/firstuser
warning
please allways place numeric fields (int,floatand ...) as the last options for example do{user:email,username,id}not{user:id,email,username}
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-01