1. Go to this page and download the library: Download txiki/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/ */
txiki / router example snippets
php
// load composer autoload
= new Route();
// add GET route
$r->get('/home', function(){
return "GET Hello world!";
});
//tell router what you want to process, the route and the http method
$route = $r->exec( '/home', 'get');
if($route!==false){
// example process response
echo $route->response;
}else{
// example response 404
echo '404';
}