lcloss/route

Simple PHP package to manage routes

dev-main 2020-10-23 23:00 UTC

This package is auto-updated.

Last update: 2024-04-25 20:30:44 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