-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbootstrap.php
More file actions
28 lines (22 loc) · 876 Bytes
/
bootstrap.php
File metadata and controls
28 lines (22 loc) · 876 Bytes
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
<?php
/*
* This file is part of the DriftPHP package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Feel free to edit as you please, and have fun.
*
* @author Marc Morera <yuhu@mmoreram.com>
*/
declare(strict_types=1);
use Symfony\Component\Dotenv\Dotenv;
$appDir = __DIR__ .'/../..';
require $appDir.'/vendor/autoload.php';
if (is_file($appDir.'/.env')) {
(new Dotenv())->loadEnv($appDir.'/.env');
}
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';