PHP code example of adaiasmagdiel / hermes
1. Go to this page and download the library: Download adaiasmagdiel/hermes 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/ */
adaiasmagdiel / hermes example snippets
daiasMagdiel\Hermes\Router;
Router::initialize();
Router::get('/', function() {
echo "Hello, World!";
});
Router::get('/about', function() {
echo "About page";
});
Router::post('/submit', function() {
// Handle form submission
});
// Optional changing the 404 page
Router::set404(function() {
http_response_code(404);
echo "This is a new 404 page.";
});
// Optional changing the 500 page
Router::set500(function() {
http_response_code(500);
echo "This is a new 500 page.";
});
Router::execute();