PHP code example of jmarcos16 / mini-router
1. Go to this page and download the library: Download jmarcos16/mini-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/ */
jmarcos16 / mini-router example snippets
use MiniRouter\Router;
use Symfony\Component\HttpFoundation\Request;
use Src\Controllers\YourController;
$routes = [
YourController::class,
];
$router = new Router($routes);
$router->handle(Request::createFromGlobals());
use MiniRouter\Attributes\Route;
class YourController
{
#[Route('/index')]
public function index()
{
return echo 'Hello World';
}
}