Webiny\Component\Http\Request\Env::get PHP Method

get() public method

Get the value from environment variables for the given $key.
public get ( string $key, null $value = null ) : string
$key string Key name.
$value null Default value that will be returned if the $key is not found.
return string Value under the defined $key.
    public function get($key, $value = null)
    {
        return $this->envBag->key($key, $value, true);
    }

Usage Example

Exemplo n.º 1
0
 public function testGet()
 {
     $_ENV = ["APP_ENV" => "development"];
     $env = new Env();
     $this->assertSame("development", $env->get("APP_ENV"));
     $this->assertNull($env->get("NON_EXISTING"));
     $this->assertSame("production", $env->get("NON_EXISTING_2", "production"));
 }
All Usage Examples Of Webiny\Component\Http\Request\Env::get