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 44
55require dirname (__DIR__ ).'/vendor/autoload.php ' ;
66
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+
711// Load cached env vars if the .env.local.php file exists
812// 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 );
1515} else {
1616 $ path = dirname (__DIR__ ).'/.env ' ;
1717 $ dotenv = new Dotenv (false );
Original file line number Diff line number Diff line change 44
55require dirname (__DIR__ ).'/vendor/autoload.php ' ;
66
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+
711// Load cached env vars if the .env.local.php file exists
812// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
913if (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 );
1515} else {
1616 // load all the .env files
1717 (new Dotenv (false ))->loadEnv (dirname (__DIR__ ).'/.env ' );
You can’t perform that action at this time.
0 commit comments