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
44Symfony Dotenv parses ` .env ` files to make environment variables stored in them
55accessible via ` $_SERVER ` or ` $_ENV ` .
66
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+
730Resources
831---------
932
10- * [ Documentation] ( https://symfony.com/doc/current/components/dotenv.html )
1133 * [ Contributing] ( https://symfony.com/doc/current/contributing/index.html )
1234 * [ Report issues] ( https://github.com/symfony/symfony/issues ) and
1335 [ send Pull Requests] ( https://github.com/symfony/symfony/pulls )
You can’t perform that action at this time.
0 commit comments