1. Go to this page and download the library: Download pinga/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/ */
pinga / router example snippets
$router = new \Delight\Router\Router();
$router = new \Delight\Router\Router('/my/base/path');
$router->get('/', function () {
// do something
});
$router->get('/users/:id/photo', function ($id) {
// get the photo for user `$id`
});
$router->any([ 'POST', 'PUT' ], '/users/:id/address', function ($id) {
// update the address for user `$id`
});
// use static methods
$router->get('/photos/:id/convert/:mode', [ 'PhotoController', 'myStaticMethod' ]);
// or
// instance methods
$router->get('/photos/:id/convert/:mode', [ $myPhotoController, 'myInstanceMethod' ]);
class MyController {
public static function someStaticMethod($database, $uuid) {
// do something
}
}