firstPHP/index.php

19 lines
592 B
PHP
Raw Normal View History

2024-03-15 14:17:25 +03:00
<?php
2024-03-20 18:31:49 +03:00
ini_set("display_errors", 1);
2024-03-15 14:17:25 +03:00
error_reporting(-1);
2024-03-15 16:56:03 +03:00
require_once "vendor/autoload.php";
2024-03-15 14:17:25 +03:00
2024-03-20 18:31:49 +03:00
use Phroute\Phroute\RouteCollector;
2024-03-15 16:56:03 +03:00
2024-03-20 18:31:49 +03:00
$router = new RouteCollector();
2024-03-15 16:56:03 +03:00
2024-03-20 18:31:49 +03:00
$router->get('/', [\itguild\forms\app\controllers\Main::class, 'indexAction']);
$router->get('/example', [\itguild\forms\app\controllers\Main::class, 'exampleAction']);
2024-03-15 17:54:06 +03:00
2024-03-20 18:31:49 +03:00
$dispatcher = new Phroute\Phroute\Dispatcher($router->getData());
2024-03-15 17:54:06 +03:00
2024-03-20 18:31:49 +03:00
$response = $dispatcher->dispatch($_SERVER['REQUEST_METHOD'], parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
2024-03-18 17:52:16 +03:00
2024-03-20 18:31:49 +03:00
// Print out the value returned from the dispatched function
echo $response;