File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 4
4
5
5
require dirname (__DIR__ ).'/vendor/autoload.php ' ;
6
6
7
+ if (!class_exists (Dotenv::class)) {
8
+ throw new LogicException ('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application. ' );
9
+ }
10
+
7
11
// Load cached env vars if the .env.local.php file exists
8
12
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
9
- if (is_array ($ env = @include dirname (__DIR__ ).'/.env.local.php ' ) && ($ _SERVER ['APP_ENV ' ] ?? $ _ENV ['APP_ENV ' ] ?? $ env ['APP_ENV ' ] ?? null ) === ($ env ['APP_ENV ' ] ?? null )) {
10
- foreach ($ env as $ k => $ v ) {
11
- $ _ENV [$ k ] = $ _ENV [$ k ] ?? (isset ($ _SERVER [$ k ]) && 0 !== strpos ($ k , 'HTTP_ ' ) ? $ _SERVER [$ k ] : $ v );
12
- }
13
- } elseif (!class_exists (Dotenv::class)) {
14
- throw new RuntimeException ('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application. ' );
13
+ if (is_array ($ env = @include dirname (__DIR__ ).'/.env.local.php ' ) && (!isset ($ env ['APP_ENV ' ]) || ($ _SERVER ['APP_ENV ' ] ?? $ _ENV ['APP_ENV ' ] ?? $ env ['APP_ENV ' ]) === $ env ['APP_ENV ' ])) {
14
+ (new Dotenv (false ))->populate ($ env );
15
15
} else {
16
16
$ path = dirname (__DIR__ ).'/.env ' ;
17
17
$ dotenv = new Dotenv (false );
Original file line number Diff line number Diff line change 4
4
5
5
require dirname (__DIR__ ).'/vendor/autoload.php ' ;
6
6
7
+ if (!class_exists (Dotenv::class)) {
8
+ throw new LogicException ('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application. ' );
9
+ }
10
+
7
11
// Load cached env vars if the .env.local.php file exists
8
12
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
9
13
if (is_array ($ env = @include dirname (__DIR__ ).'/.env.local.php ' ) && (!isset ($ env ['APP_ENV ' ]) || ($ _SERVER ['APP_ENV ' ] ?? $ _ENV ['APP_ENV ' ] ?? $ env ['APP_ENV ' ]) === $ env ['APP_ENV ' ])) {
10
- foreach ($ env as $ k => $ v ) {
11
- $ _ENV [$ k ] = $ _ENV [$ k ] ?? (isset ($ _SERVER [$ k ]) && 0 !== strpos ($ k , 'HTTP_ ' ) ? $ _SERVER [$ k ] : $ v );
12
- }
13
- } elseif (!class_exists (Dotenv::class)) {
14
- throw new RuntimeException ('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application. ' );
14
+ (new Dotenv (false ))->populate ($ env );
15
15
} else {
16
16
// load all the .env files
17
17
(new Dotenv (false ))->loadEnv (dirname (__DIR__ ).'/.env ' );
You can’t perform that action at this time.
0 commit comments