This commit is contained in:
William 2022-01-24 08:38:51 +01:00
parent 7882449469
commit 5659ee2a52
2 changed files with 19 additions and 1 deletions

16
app/core/Config.php Normal file
View File

@ -0,0 +1,16 @@
<?php
class Config
{
public array $config;
public function __construct(string $path)
{
if (!file_exists($path)) {
echo("Could not find $path");
throw new Exception("Could not find $path");
}
$this->config = require $path;
}
}

View File

@ -21,7 +21,9 @@ spl_autoload_register(function ($class_name) {
}); });
// Setup // Setup
$config = require __DIR__ . '/config.php'; $config = (
new Config(__DIR__ . '/config.php')
)->config;
$database = new Database($config['database']); $database = new Database($config['database']);
$session = new Session; $session = new Session;
$user = new User($session); $user = new User($session);