-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbootstrap.php
More file actions
47 lines (33 loc) · 1.35 KB
/
bootstrap.php
File metadata and controls
47 lines (33 loc) · 1.35 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
42
43
44
45
46
47
<?php
define('DS', DIRECTORY_SEPARATOR);
define('ROOT_PATH', realpath(__DIR__ . '/') . DS);
define('APP_PATH', realpath(__DIR__ . '/app/') . DS);
define('CONFIG_PATH', realpath(__DIR__ . '/config/') . DS);
define('STORAGE_PATH', realpath(__DIR__ . '/storage/') . DS);
define('RESOURCES_PATH', realpath(__DIR__ . '/resources/') . DS);
define('PUBLIC_PATH', realpath(__DIR__ . '/public/') . DS);
define('LIB_PATH', realpath(__DIR__ . '/lib/') . DS);
define('DATA_PATH', realpath(__DIR__ . '/data/') . DS);
define('MIGRATION_PATH', realpath(__DIR__ . '/app/Console/Migration/') . DS);
$autoload = ROOT_PATH . 'vendor' . DS . 'autoload.php';
if (!file_exists($autoload)) {
throw new Exception("Please install the project dependencies using the command (composer install or composer install --no-dev)");
}
require $autoload;
$appType = php_sapi_name() == 'cli' ? 'console' : 'http';
$default = require CONFIG_PATH . 'default.php';
$env = require CONFIG_PATH . ($default['default']['env']) . '.php';
$settings = array_merge_recursive($default, $env);
// instance app
$app = app($appType, $settings);
// Set up dependencies
$app->registerProviders();
// Register middleware
$app->registerMiddleware();
if ($appType == 'console') {
return $app;
}
// include your routes for http requests here
require CONFIG_PATH . 'routes' . DS . 'app.php';
$app->prepare();
$app->run();