Skip to content

Commit 24d734a

Browse files
wouterjfabpot
authored andcommitted
[DotEnv][WebLink][Templating][ErrorHandler] Updated README with minimal example
1 parent a78e698 commit 24d734a

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)