1. Go to this page and download the library: Download brdev/router library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
brdev / router example snippets
use BRdev\Router\Router;
use BRdev\Router\Web\Web;
::get('/','Web@home');
//or
Router::get('/',[Web::class,'web']);
Router::get('/sobre','Web@about');
//namespace
Router::namespace("BRdev\Router\App");
Router::get('/user/{id}', 'App@user');
Router::group('/error');
Router::get('/{code}','App@error');
Router::endgroup();
Router::dispatch();
//error
if(Router::error()){
Router::redirect("/error/".Router::getError());
}