Skip to content

Commit cc7a424

Browse files
Added upgrading docs
1 parent 4f26ad7 commit cc7a424

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

README.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,37 @@ dotenv](https://github.com/bkeepers/dotenv).
99

1010
[![Build Status](https://travis-ci.org/vlucas/phpdotenv.svg?branch=master)](https://travis-ci.org/vlucas/phpdotenv)
1111

12+
13+
UPGRADING FROM V2
14+
-----------------
15+
16+
New in Version 3 is first-class support for multiline variables
17+
([#301](https://github.com/vlucas/phpdotenv/pull/301)) and much more
18+
flexibility in terms of which parts of the environment we try to read and
19+
modify ([#300](https://github.com/vlucas/phpdotenv/pull/300)). Consequently,
20+
you will need to replace any occurences of `new Dotenv(...)` with
21+
`Dotenv::create(...)`, since our new native constructor takes loader instance
22+
now, so that it can be truly customized if required. Finally, one should note
23+
that starting from V3, the loader will no longer be trimming values
24+
([#302](https://github.com/vlucas/phpdotenv/pull/302)).
25+
26+
1227
Why .env?
1328
---------
1429
**You should never store sensitive credentials in your code**. Storing
1530
[configuration in the environment](http://www.12factor.net/config) is one of
1631
the tenets of a [twelve-factor app](http://www.12factor.net/). Anything that is
1732
likely to change between deployment environments – such as database credentials
18-
or credentials for 3rd party services – should be extracted from the
19-
code into environment variables.
20-
21-
Basically, a `.env` file is an easy way to load custom configuration
22-
variables that your application needs without having to modify .htaccess
23-
files or Apache/nginx virtual hosts. This means you won't have to edit
24-
any files outside the project, and all the environment variables are
25-
always set no matter how you run your project - Apache, Nginx, CLI, and
26-
even PHP 5.4's built-in webserver. It's WAY easier than all the other
27-
ways you know of to set environment variables, and you're going to love
28-
it.
33+
or credentials for 3rd party services – should be extracted from the code into
34+
environment variables.
35+
36+
Basically, a `.env` file is an easy way to load custom configuration variables
37+
that your application needs without having to modify .htaccess files or
38+
Apache/nginx virtual hosts. This means you won't have to edit any files outside
39+
the project, and all the environment variables are always set no matter how you
40+
run your project - Apache, Nginx, CLI, and even PHP 5.4's built-in webserver.
41+
It's WAY easier than all the other ways you know of to set environment
42+
variables, and you're going to love it!
2943

3044
* NO editing virtual hosts in Apache or Nginx
3145
* NO adding `php_value` flags to .htaccess files

0 commit comments

Comments
 (0)