2024-07-03 14:41:15 +03:00
|
|
|
<?php
|
|
|
|
require_once "vendor/autoload.php";
|
|
|
|
require 'bootstrap.php';
|
|
|
|
|
2024-07-03 15:15:59 +03:00
|
|
|
use app\controllers\MainController;
|
2024-07-03 14:41:15 +03:00
|
|
|
use Controllers\Users;
|
|
|
|
use Controllers\Questions;
|
|
|
|
use Controllers\Answers;
|
|
|
|
use Controllers\Posts;
|
|
|
|
use Phroute\Phroute\RouteCollector;
|
|
|
|
|
2024-07-03 15:15:59 +03:00
|
|
|
|
|
|
|
$router = new RouteCollector();
|
|
|
|
|
|
|
|
$router->get('/', [MainController::class, 'actionIndex']);
|
|
|
|
$router->get('/example', [MainController::class, 'actionExample']);
|
|
|
|
|
|
|
|
$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;
|