PHP code example of logadapp / router
1. Go to this page and download the library: Download logadapp/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/ */
logadapp / router example snippets
$router = new LogadApp\Router\Router();
$router->get('/', function () {
// Handle GET request for the root path
});
$router->post('/users', function () {
// Handle POST request for the /users path
});
$router->group('/auth', function() use ($router) {
$router->post('/login', [AuthController::class, 'login']);
$router->post('/register', function () {
// Handle POST request for the /auth/register path
});
}
$router->run();