public function bootEnv(string
$path, string
$defaultEnv = 'dev', array
$testEnvs =
['test'
], bool
$overrideExistingVars = false
): void
{ $p =
$path.'.local.php';
$env =
is_file($p) ?
include $p : null;
$k =
$this->envKey;
if (\
is_array($env) && ($overrideExistingVars || !
isset($env[$k]) || ($_SERVER[$k] ??
$_ENV[$k] ??
$env[$k]) ===
$env[$k])) { $this->
populate($env,
$overrideExistingVars);
} else { $this->
loadEnv($path,
$k,
$defaultEnv,
$testEnvs,
$overrideExistingVars);
} $_SERVER +=
$_ENV;
$k =
$this->debugKey;
$debug =
$_SERVER[$k] ?? !\
in_array($_SERVER[$this->envKey
],
$this->prodEnvs, true
);
$_SERVER[$k] =
$_ENV[$k] =
(int) $debug || (!\
is_bool($debug) &&
filter_var($debug, \FILTER_VALIDATE_BOOL
)) ? '1' : '0';
} /**
* Loads one or several .env files and enables override existing vars.
*
* @param string $path A file to load
* @param string ...$extraPaths A list of additional files to load
*
* @throws FormatException when a file has a syntax error
* @throws PathException when a file does not exist or is not readable
*/