/
bootstrap.php
55 lines (42 loc) · 1.55 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
use Laravel\Octane\Exceptions\DdException;
ini_set('display_errors', 'stderr');
$_ENV['APP_RUNNING_IN_CONSOLE'] = false;
/*
|--------------------------------------------------------------------------
| Find Application Base Path
|--------------------------------------------------------------------------
|
| First we need to locate the path to the application bootstrapper, which
| is able to create a fresh copy of the Laravel application for us and
| we can use this to handle requests. For now we just need the path.
|
*/
$basePath = $_SERVER['APP_BASE_PATH'] ?? $_ENV['APP_BASE_PATH'] ?? $serverState['octaneConfig']['base_path'] ?? null;
if (! is_string($basePath)) {
fwrite(STDERR, 'Cannot find application base path.'.PHP_EOL);
exit(11);
}
if (! function_exists('dd')) {
function dd(...$vars)
{
throw new DdException($vars);
}
}
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
if (! is_file($autoload_file = $basePath.'/vendor/autoload.php')) {
fwrite(STDERR, "Composer autoload file was not found. Did you install the project's dependencies?".PHP_EOL);
exit(10);
}
require_once $autoload_file;
return $basePath;