summaryrefslogtreecommitdiff
path: root/src/App.php
blob: 7524d38b869b338057d745e36c6b46dfcdafa863 (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
<?php

namespace App;

use Symfony\Component\HttpFoundation\Request;

class App
{
  public function __construct() {
    if ($_ENV['APP_ENV'] === 'development') {
      error_reporting(E_ALL);
    }

    // Session
    session_start();

    // DB
    DB::init();

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

    // View
    View::init();

    // Events
    new EventRunner();
  }

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