Skip to content

Instantly share code, notes, and snippets.

@john555
Last active June 28, 2018 09:11
Show Gist options
  • Save john555/084a35fb619ae1e03ae0bfe4475a5eba to your computer and use it in GitHub Desktop.
Save john555/084a35fb619ae1e03ae0bfe4475a5eba to your computer and use it in GitHub Desktop.
<?php
include_once 'Request.php';
include_once 'Router.php';
$router = new Router(new Request);
$router->get('/', function() {
return <<<HTML
<h1>Hello world</h1>
HTML;
});
$router->get('/profile', function($request) {
return <<<HTML
<h1>Profile</h1>
HTML;
});
$router->post('/data', function($request) {
return json_encode($request->getBody());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment