|
1 |
| -CakePHP 3.x Environment Plugin |
2 |
| -============================== |
| 1 | +# CakePHP 3.x Environment Plugin |
3 | 2 |
|
4 |
| -[](https://travis-ci.org/frankfoerster/cakephp-environment) |
| 3 | +[](LICENSE) |
| 4 | +[](https://travis-ci.org/frankfoerster/cakephp-environment) |
| 5 | +[](https://coveralls.io/github/frankfoerster/cakephp-environment) |
| 6 | +[](https://packagist.org/packages/frankfoerster/cakephp-environment) |
| 7 | +[](https://packagist.org/packages/frankfoerster/cakephp-environment) |
5 | 8 |
|
6 | 9 | Manage multiple environments in your CakePHP application that differ in, e.g.:
|
7 | 10 |
|
8 | 11 | - database setup
|
9 | 12 | - configuration settings (Configure)
|
10 | 13 | - custom feature flags
|
11 | 14 |
|
12 |
| -Requirements |
13 |
| ------------- |
| 15 | +## Requirements |
14 | 16 |
|
15 | 17 | - PHP 5.6.0+
|
16 | 18 | - CakePHP 3.x
|
17 | 19 |
|
18 |
| -1. What it does |
19 |
| ---------------- |
| 20 | +## What it does |
20 | 21 |
|
21 | 22 | The Environment plugin hooks into your bootstrap process to initialize the database configuration, configuration parameters and additional custom logic for different environments.
|
22 | 23 |
|
23 | 24 | An environment is defined and detected either by a set of domains (e.g. www.domain.com, domain.com, domain.net) or optionally by the absolute app path on a server (cli).
|
24 | 25 |
|
25 |
| -2. Install and use the plugin |
26 |
| ------------------------------ |
27 |
| - |
28 |
| -1. `composer require frankfoerster/cakephp-environment` |
29 |
| -2. Copy the example configuration files from `example/config/Environment` to your app `/config/Environment` |
30 |
| -3. Add the following lines to your `config/bootstrap.php` file |
31 |
| - |
32 |
| - ```php |
33 |
| - use FrankFoerster\Environment\Environments; |
34 |
| - |
35 |
| - Plugin::load('FrankFoerster/Environment'); |
36 |
| - Environments::init(); |
37 |
| - ``` |
| 26 | +## Install and use the plugin |
| 27 | + |
| 28 | +1. `composer require frankfoerster/cakephp-environment` |
| 29 | +2. Copy the example configuration files from `example/config/Environment` to your app `/config/Environment` |
| 30 | +3. Add the following lines to your `config/bootstrap.php` file |
| 31 | + |
| 32 | + ```php |
| 33 | + use FrankFoerster\Environment\Environments; |
| 34 | + |
| 35 | + Plugin::load('FrankFoerster/Environment'); |
| 36 | + Environments::init(); |
| 37 | + ``` |
| 38 | + |
| 39 | + before |
| 40 | + ```php |
| 41 | + ConnectionManager::config(Configure::consume('Datasources')); |
| 42 | + ``` |
| 43 | + |
| 44 | + If you want to setup environment specific settings for any "consumed" configuration option, then make sure your environments are initialized **before** the corresponding ``Configure::consume('...')`` call. |
38 | 45 |
|
39 | 46 | Tags ~1.0 are releases for CakePHP 2.x support (master branch).
|
40 | 47 | Tags ~3.0 are releases for CakePHP 3.x support (cake3 branch).
|
41 | 48 |
|
42 |
| -3. Configuration |
43 |
| ----------------- |
| 49 | +## Configuration |
44 | 50 |
|
45 | 51 | The configuration of your environments is managed with multiple files.
|
46 | 52 |
|
|
0 commit comments