-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
41 lines (31 loc) · 1.09 KB
/
Copy pathbootstrap.php
File metadata and controls
41 lines (31 loc) · 1.09 KB
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
<?php
require 'vendor/autoload.php';
// Instantiate the app
$settings = require __DIR__ . '/src/settings.php';
$app = new \Slim\App($settings);
// Set up dependencies
require __DIR__ . '/src/dependencies.php';
// Register middleware
require __DIR__ . '/src/middleware.php';
// Register routes
require __DIR__ . '/src/routes.php';
// Register Config
if (file_exists('davework.json')) {
$configJson = file_get_contents('davework.json');
} else {
die("Couldn't find davework.json\n");
}
$projectRoot = pathinfo(realpath('davework.json'), PATHINFO_DIRNAME);
$config = json_decode($configJson);
$config->rootDirectory = $projectRoot . '/' . $config->rootDirectory;
$config->testsDirectory = $projectRoot . '/' . $config->testsDirectory;
if (!isset($config->factoriesLiveWithClasses)) {
$config->factoriesLiveWithClasses = false;
}
if (isset($config->newProjectDirectory)) {
$newProjectDirectory = $config->newProjectDirectory;
} else {
$newProjectDirectory = $config->rootDirectory;
}
$config->newProjectDirectory = $projectRoot . '/' . $newProjectDirectory;
$container['config'] = $config;