| Package Data | |
|---|---|
| Maintainer Username: | mul14 |
| Maintainer Contact: | mul14.net@gmail.com (Mulia Arifandi Nasution) |
| Package Create Date: | 2016-08-05 |
| Package Last Update: | 2016-08-05 |
| Home Page: | https://packagist.org/packages/nasution/laravel-implicit-routes |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-22 15:12:35 |
| Package Statistics | |
|---|---|
| Total Downloads: | 25 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 6 |
| Total Watchers: | 0 |
| Total Forks: | 0 |
| Total Open Issues: | 1 |
Make implicit routes to Laravel. It's very similar like CodeIgniter routes.
composer require nasution/laravel-implicit-routes
Register service provider inside providers in config/app.php file.
Nasution\ImplicitRoutes\ServiceProvider::class,
Add Route::anything() to your routes file.
Route::anything();
Route::get('/', 'HomeController@welcome');
Now, you have capability to visit any path. For example, if you visit
http://localhost/products/shoes/42, it's equivalent
Route::any('products/shoes/{param0}', 'ProductsController@shoes');
class ProductsContoller extends Controller
{
public function shoes($id)
{
return $id; // 42
}
}
If you visit address without second segment, it will use index method. For example http://localhost/products, it's equivalent
Route::any('products', 'ProductsController@index');
class ProductsContoller extends Controller
{
public function index()
{
//
}
}
MIT © Mulia Arifandi Nasution