File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,32 @@ Dotenv Component
4
4
Symfony Dotenv parses ` .env ` files to make environment variables stored in them
5
5
accessible via ` $_SERVER ` or ` $_ENV ` .
6
6
7
+ Getting Started
8
+ ---------------
9
+
10
+ ```
11
+ $ composer require symfony/dotenv
12
+ ```
13
+
14
+ ``` php
15
+ use Symfony\Component\Dotenv\Dotenv;
16
+
17
+ $dotenv = new Dotenv();
18
+ $dotenv->load(__DIR__.'/.env');
19
+
20
+ // you can also load several files
21
+ $dotenv->load(__DIR__.'/.env', __DIR__.'/.env.dev');
22
+
23
+ // overwrites existing env variables
24
+ $dotenv->overload(__DIR__.'/.env');
25
+
26
+ // loads .env, .env.local, and .env.$APP_ENV.local or .env.$APP_ENV
27
+ $dotenv->loadEnv(__DIR__.'/.env');
28
+ ```
29
+
7
30
Resources
8
31
---------
9
32
10
- * [ Documentation] ( https://symfony.com/doc/current/components/dotenv.html )
11
33
* [ Contributing] ( https://symfony.com/doc/current/contributing/index.html )
12
34
* [ Report issues] ( https://github.com/symfony/symfony/issues ) and
13
35
[ send Pull Requests] ( https://github.com/symfony/symfony/pulls )
You can’t perform that action at this time.
0 commit comments