@@ -9,23 +9,37 @@ dotenv](https://github.com/bkeepers/dotenv).
9
9
10
10
[ ![ Build Status] ( https://travis-ci.org/vlucas/phpdotenv.svg?branch=master )] ( https://travis-ci.org/vlucas/phpdotenv )
11
11
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
+
12
27
Why .env?
13
28
---------
14
29
** You should never store sensitive credentials in your code** . Storing
15
30
[ configuration in the environment] ( http://www.12factor.net/config ) is one of
16
31
the tenets of a [ twelve-factor app] ( http://www.12factor.net/ ) . Anything that is
17
32
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!
29
43
30
44
* NO editing virtual hosts in Apache or Nginx
31
45
* NO adding ` php_value ` flags to .htaccess files
0 commit comments