This repository has been archived on 2023-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
web/app/inc.php

38 lines
633 B
PHP
Raw Normal View History

2022-01-15 10:26:02 +00:00
<?php
/*
This is the main file to be included on every page.
It will act as a front controller of our application.
2022-01-16 16:12:04 +00:00
_____
/ \
| () () |
\ ^ /
|||||
|||||
Tread carefully
2022-01-15 10:26:02 +00:00
*/
2022-01-17 10:25:34 +00:00
// Autoloader
2022-01-15 10:26:02 +00:00
spl_autoload_register(function ($class_name) {
require __DIR__ . '/core/' . $class_name . '.php';
});
2022-01-17 10:25:34 +00:00
2022-01-21 20:32:21 +00:00
// Setup
$config = require __DIR__ . '/config.php';
$database = new Database($config['database']);
$session = new Session;
$app = new App(
$config,
$database,
$session
);
// We will want to use $app instead
unset(
$config,
$database,
$session
);
return $app;