-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
55 lines (53 loc) · 1.84 KB
/
bootstrap.php
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/*
|--------------------------------------------------------------------------
| Syrict types
|--------------------------------------------------------------------------
*/
declare(strict_types=1);
/*
|--------------------------------------------------------------------------
| Start session
|--------------------------------------------------------------------------
*/
session_start();
/*
|--------------------------------------------------------------------------
| Error reporting enabled default remove for production
|--------------------------------------------------------------------------
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| Autoload classes
|--------------------------------------------------------------------------
*/
include 'vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Imports
|--------------------------------------------------------------------------
*/
use VC4A\Repository\DocumentsRepository;
use VC4A\Repository\UploadRepository;
use VC4A\Model\UploadModel;
use VC4A\Model\DocumentsModel;
/*
|--------------------------------------------------------------------------
| Load configuration
|--------------------------------------------------------------------------
*/
$config = include 'config/config.php';
/*
|--------------------------------------------------------------------------
| Create database object instance
|--------------------------------------------------------------------------
*/
try {
$pdo = new PDO(...$config['db']); // Better would be to store this into a IoC container.
} catch (PDOException $exception) {
echo $exception->getMessage();
}
$documentsModel = new DocumentsModel(new DocumentsRepository($pdo));
$uploadModel = new UploadModel(new UploadRepository());