PHP code example of daniel-griffiths / simple-route
1. Go to this page and download the library: Download daniel-griffiths/simple-route 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/ */
daniel-griffiths / simple-route example snippets
er = new DanielGriffiths\Router($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);
// long form for binding a route, supports get/post requests
$router->add('GET', '/this-is-a-test', 'ExampleClassName@ExampleMethod');
// short hand for binding a route
$router->get('/this-is-a-test', 'ExampleClassName@ExampleMethod');
$router->post('/this-is-a-test', 'ExampleClassName@ExampleMethod');
$router->dispatch();