for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
if (!function_exists('env')) {
/**
* Gets the value of an environment variable.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
function env(string $key, $default = null)
{
$value = getenv($key);
if ($value === false) {
return value($default);
}
switch (strtolower($value)) {
case 'true':
case '(true)':
return true;
case 'false':
case '(false)':
return false;
case 'empty':
case '(empty)':
return '';
case 'null':
case '(null)':
return null;
if (($valueLength = strlen($value)) > 1 && strpos($value, '"') === 0 && $value[$valueLength - 1] === '"') {
return substr($value, 1, -1);
return $value;
if (!function_exists('value')) {
* Return the default value of the given value.
* @param mixed $value
function value($value)
return $value instanceof Closure ? $value() : $value;