alineisi / router
this package is used to implement routing system with a lot of cool features !!!
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 2
Open Issues: 0
pkg:composer/alineisi/router
README
Routing system for PHP
Requries PHP >= 7.0
Installation
composer require alineisi/router
To get started
require_once __DIR__ . '/vendor/autoload.php';use Alineisi\Route;
be sure adding
Route::dispatch();
end of index.php
Usage
ex.1
Route::get('/', function () {return 'Hello World';});
ex.2
Route::get('/', [HomeController::class, 'index']);
ex.3
Route::post('/submit', function () {return $_POST['name'];});
Features
you can set not found page by using
Route::notFoundPath($path);
set named routes by using name method after routing, for example:
Route::get('/', function () {return 'Hello World';})->name('index');
and to use it:
\Alineisi\routeName('index');
you can also returning views by using
Route::view('/', 'index');
or
Route::view('/', 'index.php');