PHP code example of john-jun / route
1. Go to this page and download the library: Download john-jun/route 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/ */
john-jun / route example snippets
$route = new Air\Routing\Route();
//add route
$route->get('/get', '{className}@{method}');
$route->cli('/cli', '{className}@{method}');
$route->put('/put', '{className}@{method}');
$route->head('/head', '{className}@{method}');
$route->post('/post', '{className}@{method}');
$route->patch('/patch', '{className}@{method}');
$route->delete('/delete', '{className}@{method}');
$route->options('/options', '{className}@{method}');
//add route group
$route->group('prefix', static function(Air\Routing\Route $route) {
$route->get('/get', '{className}@{method}');
$route->cli('/cli', '{className}@{method}');
$route->put('/put', '{className}@{method}');
$route->head('/head', '{className}@{method}');
$route->post('/post', '{className}@{method}');
$route->patch('/patch', '{className}@{method}');
$route->delete('/delete', '{className}@{method}');
$route->options('/options', '{className}@{method}');
});
print_r($route->dispatch('/get'));
print_r($route->dispatch('/prefix/get'));