summaryrefslogtreecommitdiff
path: root/src/http/Http.php
blob: 1867eb46c8db24c5aa0a95846c6c60a8d0703bf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

namespace App\http;

use App\DB;
use App\EventRunner;
use App\http\Router;
use App\View;
use Symfony\Component\HttpFoundation\Request;

class Http
{
  public function __construct()
  {
    // Session
    session_start();

    // DB
    DB::init();

    // Router
    Router::init(Request::createFromGlobals());

    // View
    View::init();
    View::addGlobal('session', $_SESSION);

    // Events
    new EventRunner();
  }

  public function run(): void
  {
    $response = Router::execute();
    $response->send();
  }
}