function load_env()
{
if ($fh = fopen('../.env', 'r')) {
while (!feof($fh)) {
$line = fgets($fh);
putenv($line);
}
fclose($fh);
}
}
function env($key, $default = null)
{
$value = getenv($key);
if ($value === false) {
return $default;
}
return $value;
}
Created
December 20, 2019 16:22
-
-
Save ahmadrosid/84dc7bbc817f5058b2bf0a546cb4bce6 to your computer and use it in GitHub Desktop.
PHP super simple dotenv
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment