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

namespace App;

use Symfony\Component\HttpFoundation\Request;

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

    // DB
    DB::init();

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

    // View
    View::init();

    // Events
    new EventRunner();
  }

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