1. Go to this page and download the library: Download exan/poopexpress 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/ */
exan / poopexpress example snippets
$router = new PoopExpress($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);
$router->attempt([''], ['GET', function () {
echo 'Home page';
}]) || $router->attempt(['somewhere-else'], ['GET' => function () {
echo 'This is a different page';
}]);
$router->attempt(['group', '*'], ['GET' => function ($id) {
echo 'This page is within the "group", ', $id;
}]);
(
$router->group(['group']) && (
$router->attempt(['group', 'nowhere'], ['GET' => function () {
echo 'This page is also within the "group"';
}]) || $router->attempt(['group', 'some-other-group'], ['POST' => function () {
echo 'This page is yet again within the "group"';
}])
)
)
$router = new PoopExpress($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);
$router->attempt([''], ['GET', function () {
echo 'Home page';
}]) || $router->attempt(['somewhere-else'], ['GET' => function () {
echo 'This is a different page';
}]) || (
$router->group(['group']) && (
$router->attempt(['group', 'nowhere'], ['GET' => function () {
echo 'This page is also within the "group"';
}]) || $router->attempt(['group', 'some-other-group'], ['POST' => function () {
echo 'This page is yet again within the "group"';
}]) || $router->attempt(['group', '*'], ['GET' => function ($id) {
echo 'This page is within the "group", ', $id;
}])
)
) || $router->attempt(['not-group', 'page'], ['GET' => function () {
echo 'This is no longer in the group';
}]) || (function () {
http_response_code(404);
echo '404';
})();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.