proximity / detectenv
There is no license information available for the latest version (v1.0.3) of this package.
A simple PHP class to detect environment depending on server name
v1.0.3
2016-11-07 11:42 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 5.6.*
This package is auto-updated.
Last update: 2025-01-08 23:05:24 UTC
README
Simple PHP Class to get environment depending on server name
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist proximity/detectenv "1.0.*"
or add
"proximity/detectenv": "1.0.*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
$hosts = [ 'mydevhost.dev'=>'dev', 'mytesthost.com'=>'test', 'myprodhost.com'=>'prod', ]; $env = \proximity\detectenv\DetectEnv::get($hosts);
By default if no host is found it will return null, you can change the default host by adding the second parameter:
$env = \proximity\detectenv\DetectEnv::get($hosts, 'prod');