PHP code example of marcolamr / router
1. Go to this page and download the library: Download marcolamr/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/ */
marcolamr / router example snippets
colaMr\Router\Response;
use MarcolaMr\Router\Router;
define("URL", "http://localhost:8000");
$router = new Router(URL);
$router->get("/", [
function() {
return new Response(200, "Hello World");
}
]);
$router->get("/controller", [
function() {
return new Response(200, Controller::method());
}
]);
$router->get("/{id}", [
function($id) {
return new Response(200, var_dump($id));
}
]);
$router->run()->sendResponse();