firstPHP/index.php
2024-03-20 18:31:49 +03:00

19 lines
592 B
PHP

<?php
ini_set("display_errors", 1);
error_reporting(-1);
require_once "vendor/autoload.php";
use Phroute\Phroute\RouteCollector;
$router = new RouteCollector();
$router->get('/', [\itguild\forms\app\controllers\Main::class, 'indexAction']);
$router->get('/example', [\itguild\forms\app\controllers\Main::class, 'exampleAction']);
$dispatcher = new Phroute\Phroute\Dispatcher($router->getData());
$response = $dispatcher->dispatch($_SERVER['REQUEST_METHOD'], parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
// Print out the value returned from the dispatched function
echo $response;