for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace AbterPhp\Framework\Config;
use AbterPhp\Framework\Constant\Env;
use Opulence\Environments\Environment;
class EnvReader
{
/**
* @return bool
*/
public function isStaging(): bool
return Environment::getVar(Env::ENV_NAME) === Environment::STAGING;
}
public function isTesting(): bool
return Environment::getVar(Env::ENV_NAME) === Environment::TESTING;
public function isDevelopment(): bool
return Environment::getVar(Env::ENV_NAME) === Environment::DEVELOPMENT;
public function isProduction(): bool
return Environment::getVar(Env::ENV_NAME) === Environment::PRODUCTION;
* @param string $envName
* @param string $expected
* @param string|null $default
*
public function is(string $envName, string $expected, $default = null): bool
return $this->get($envName, $default) === $expected;
* @return string|null
public function get(string $envName, $default = null): ?string
return Environment::getVar($envName, $default);
* @deprecated This method should probably only be used in tests. No removal is planned.
* @param string|null $value
* @return $this
public function set(string $envName, ?string $value): EnvReader
Environment::setVar($envName, $value);
return $this;