38 lines
633 B
PHP
38 lines
633 B
PHP
<?php
|
|
/*
|
|
This is the main file to be included on every page.
|
|
It will act as a front controller of our application.
|
|
_____
|
|
/ \
|
|
| () () |
|
|
\ ^ /
|
|
|||||
|
|
|||||
|
|
|
|
Tread carefully
|
|
*/
|
|
|
|
// Autoloader
|
|
spl_autoload_register(function ($class_name) {
|
|
require __DIR__ . '/core/' . $class_name . '.php';
|
|
});
|
|
|
|
// 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; |