Skip to content

Commit 134f5fa

Browse files
committed
improve readme by adding a hint on where to initialize the environments #4, restructure headings
1 parent f63c028 commit 134f5fa

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

README.md

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,52 @@
1-
CakePHP 3.x Environment Plugin
2-
==============================
1+
# CakePHP 3.x Environment Plugin
32

4-
[![Build Status](https://travis-ci.org/frankfoerster/cakephp-environment.svg?branch=cake3)](https://travis-ci.org/frankfoerster/cakephp-environment)
3+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
4+
[![Build Status](https://img.shields.io/travis/frankfoerster/cakephp-environment/cake3.svg?style=flat-square)](https://travis-ci.org/frankfoerster/cakephp-environment)
5+
[![Coverage Status](https://img.shields.io/coveralls/frankfoerster/cakephp-environment/cake3.svg?style=flat-square)](https://coveralls.io/github/frankfoerster/cakephp-environment)
6+
[![Total Downloads](https://img.shields.io/packagist/dt/frankfoerster/cakephp-environment.svg?style=flat-square)](https://packagist.org/packages/frankfoerster/cakephp-environment)
7+
[![Latest Stable Version](https://img.shields.io/packagist/v/frankfoerster/cakephp-environment.svg?style=flat-square&label=stable)](https://packagist.org/packages/frankfoerster/cakephp-environment)
58

69
Manage multiple environments in your CakePHP application that differ in, e.g.:
710

811
- database setup
912
- configuration settings (Configure)
1013
- custom feature flags
1114

12-
Requirements
13-
------------
15+
## Requirements
1416

1517
- PHP 5.6.0+
1618
- CakePHP 3.x
1719

18-
1. What it does
19-
---------------
20+
## What it does
2021

2122
The Environment plugin hooks into your bootstrap process to initialize the database configuration, configuration parameters and additional custom logic for different environments.
2223

2324
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).
2425

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.
3845

3946
Tags ~1.0 are releases for CakePHP 2.x support (master branch).
4047
Tags ~3.0 are releases for CakePHP 3.x support (cake3 branch).
4148

42-
3. Configuration
43-
----------------
49+
## Configuration
4450

4551
The configuration of your environments is managed with multiple files.
4652

0 commit comments

Comments
 (0)