ahmmmmad11 / inhanced-routing
alternative laravel routing package
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/ahmmmmad11/inhanced-routing
This package is not auto-updated.
Last update: 2025-10-11 17:49:10 UTC
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}