1. Go to this page and download the library: Download lefodeurcou/crazy-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/ */
lefodeurcou / crazy-router example snippets
if (isset($params['id']))
echo $params['id'];
use Crazy\Router;
$router = new Crazy\Router();
$router->addRoute(Crazy\Router::GET, '/', function () {echo 'Example';});
$router->run();
use Crazy\Router;
$router = new Crazy\Router();
function example ($params)
{
if (isset($params['id']))
echo $params['id'];
}
$router->addRoute(Crazy\Router::GET, '/user/{id}', 'example', [
'[0-9]+',
]);
$router->run();
use Crazy\Router;
$router = new Crazy\Router();
class demo
{
public function example() {
echo 'Example';
}
}
$router->addRoute(Crazy\Router::GET, '/', [new demo(), 'example'], [], 'Demo route');
$router->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.