lcloss / route
Simple PHP package to manage routes
dev-main
2020-10-23 23:00 UTC
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-25 21:30:22 UTC
README
Simple package to handle routes
Install
$ composer require lcloss/route
Use
Create routes like these:
Route::get('/', 'MainController@index'); Route::get('/view', 'ViewController@index'); Route::get(['set' => '/edit', 'as' => 'edit'], 'ViewController@edit'); Route::get(['set' => '/show/{id}', 'as' => 'show'], 'ViewController@show'); Route::get('/test/one/two/tree', function() { echo '<a href="' . Route::translate('show', ['id' => 1]) . '">Show record 1</a>'; });
Sample helper
You can create an helper easly. An exemple is located at helpers
folder.
Inspiration
This work was inspired by the fantastic article Construir um sistema de rotas para MVC, de Alexandre Barbosa