yii-environment Environment-based configuration class (for example in development, testing, staging and production).

  1. Introduction
  2. Resources

Introduction

Using this you can predefine configurations for use in different environments, like development, testing, staging and production.

The main config (main.php) is extended to include the Yii paths and debug flags. There are mode_<environment>.php files for overriding and extending main.php for specific environments. Additionally, you can overrride the resulting config by using a local.php config, to make changes that will only apply to your specific installation.

This class was designed to have minimal impact on the default Yii generated files. Minimal changes to the index/bootstrap and existing config files are needed.

The Environment is determined with PHP's getenv(), which searches $_SERVER and $_ENV. There are multiple ways to set the environment depending on your preference. Setting the environment variable is trivial on both Windows and Linux, instructions included. You can optionally override the environment by creating a mode.php in the config directory.

If you want to customize this class or its config and modes, extend it! (see ExampleEnvironment.php)

Resources

All information is available within the GitHub-project:

32 0
49 followers
3 484 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Others
Developed by: marcovtwout
Created on: Mar 11, 2011
Last updated: 9 years ago

Downloads

show all

Related Extensions