webCOMAND

env::__toString()

Get the environment object's environment name as a string.  In other words, when an environment object is referenced in a string context, it will simply resolve to the environment path identifier, like 'dev', 'staging' or '' (for production).

Prototype

__toString()

Return

Get the environment object's environment name as a string. 

Example

// use the webCOMAND Framework to set the package environment based on
// the active user and their selected environment or the env query
// parameter (ie. ?env=staging).  If env=staging, the COMAND auto-
// loader will find packages in the packages/staging subfolder if it
// exists, otherwise fallback to the main packages folder(s).
$framework = new \com_webcomand::framework();
$env = new \io_comand_env\env(['framework'=>$framework]);

echo("Environment = $env");
// subsequent packages will auto-load from the appropriate environment