1. Go to this page and download the library: Download vitodtagliente/pure-routing 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/ */
vitodtagliente / pure-routing example snippets
$router = new Pure/Routing/Router();
$router->get('/foo', $callback); // GET method
$router->post('/foo', $callback); // POST method
$router->put('/foo', $callback); // PUT method
$router->delete('/foo', $callback); // DELETE method
$router->get('/foo', function(){ ... });
function foo(){ ... }
$router->get('/foo', 'foo');
use Pure\Routing\Middleware;
class AuthMiddleware extends Middleware
{
public function handle(){
// returns true if the user is logged in
return MyAuthNamespace\Auth::check();
}
}