/php-route

Simple package to handle routes

Primary LanguagePHPMIT LicenseMIT

php-route

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