webCOMAND

io_comand_env\env

A simple framework to help define and access development, staging and production environments.

Environments are useful for developing and testing packages before they are ready for release to production.

Constants

The following constants are available.

  • ENV_NAMESPACE = 'io_comand_env'
  • USER_ENVIRONMENT = 'io.comand.env'
  • RUN_ENVIRONMENT_PRIVILEGE - 'ENVIRONMENT_RUN'

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