forked from larastan/larastan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
29 lines (23 loc) · 1.05 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
<?php
declare(strict_types=1);
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Contracts\Foundation\Application;
use Laravel\Lumen\Application as LumenApplication;
use NunoMaduro\Larastan\ApplicationResolver;
use Orchestra\Testbench\Concerns\CreatesApplication;
define('LARAVEL_START', microtime(true));
if (file_exists($applicationPath = getcwd().'/bootstrap/app.php')) { // Applications and Local Dev
$app = require $applicationPath;
} elseif (file_exists($applicationPath = dirname(__DIR__, 3).'/bootstrap/app.php')) { // Relative path from default vendor dir
$app = require $applicationPath;
} elseif (trait_exists(CreatesApplication::class)) { // Packages
$app = ApplicationResolver::resolve();
} else {
throw new Exception('Could not find Laravel bootstrap file nor Testbench is installed. Install orchestra/testbench if analyzing a package.');
}
if ($app instanceof Application) {
$app->make(Kernel::class)->bootstrap();
} elseif ($app instanceof LumenApplication) {
$app->boot();
}
define('LARAVEL_VERSION', $app->version());