corso https://vola.udemy.com/course/php-mvc-from-scratch/learn/lecture/40931984#overview
filippo.bertilotti
2024-05-07 931be5e6dc02a5b01e71b3449edfff6ac44a3ae5
src/router.php
@@ -0,0 +1,22 @@
<?php
class Router {
    private array $routes = [];
    public function add(string $path, array $params = []): void {
        $this->routes[] = [
            "path"=> $path,
            "params"=> $params
        ];
    }
    public function match (string $path,): array|bool {
        foreach ($this->routes as $route) {
            if ($route["path"] === $path) {
                return $route["params"];
            }
        }
        return false;
    }
}