Skip to content

Commit 42d2a18

Browse files
Merge branch '5.0' into 5.1
* 5.0: Handle fetch mode deprecation of DBAL 2.11. Fixed handling of CSRF logout error [WebProfilerBundle] changed label of memory usage in time panel (Mb into MiB) [DotEnv][WebLink][Templating][ErrorHandler] Updated README with minimal example
2 parents 1f83cd7 + efd887f commit 42d2a18

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,32 @@ Dotenv Component
44
Symfony Dotenv parses `.env` files to make environment variables stored in them
55
accessible 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+
730
Resources
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)

0 commit comments

Comments
 (0)