1. Go to this page and download the library: Download hexbit/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.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hexbit / router example snippets
// for wordpress projectsuseHexbit\Router\WordPress\Router;
// first init router
add_action("init", function(){
Router::init();
});
// Creates a route that matches the uri `/posts/list` both GET // and POST requests.
Router::map(['GET', 'POST'], 'posts/list', function(){
return'Hello World';
});
// use this class for non wordpress systemsuseHexbit\Router\Router;
// Creates a route that matches the uri `/posts/list` both GET // and POST requests.
Router::map(['GET', 'POST'], 'posts/list', function(){
return'Hello World';
});