This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/Dotenv
Nicolas Grekas f36ec7cc81 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
2020-05-28 10:20:44 +02:00
..
Exception Allow \Throwable $previous everywhere 2019-11-12 15:51:11 +01:00
Tests [Dotenv] Add Dotenv::bootEnv() to check for .env.local.php before calling Dotenv::loadEnv() 2020-01-28 12:41:19 +01:00
.gitattributes add missing gitattributes for phpunit-bridge 2020-03-27 17:54:36 +01:00
.gitignore [Dotenv] added the component 2017-01-12 08:39:44 -08:00
CHANGELOG.md [Dotenv] Add Dotenv::bootEnv() to check for .env.local.php before calling Dotenv::loadEnv() 2020-01-28 12:41:19 +01:00
composer.json Merge branch '5.0' into 5.1 2020-05-20 19:43:50 +02:00
Dotenv.php Use is_file() instead of file_exists() where possible 2020-04-24 00:29:19 +02:00
LICENSE Update year in license files 2020-01-01 12:03:25 +01:00
phpunit.xml.dist Merge branch '2.8' into 3.4 2018-11-11 20:48:54 +01:00
README.md [DotEnv][WebLink][Templating][ErrorHandler] Updated README with minimal example 2020-05-26 11:42:42 +02:00

Dotenv Component

Symfony Dotenv parses .env files to make environment variables stored in them accessible via $_SERVER or $_ENV.

Getting Started

$ composer require symfony/dotenv
use Symfony\Component\Dotenv\Dotenv;

$dotenv = new Dotenv();
$dotenv->load(__DIR__.'/.env');

// you can also load several files
$dotenv->load(__DIR__.'/.env', __DIR__.'/.env.dev');

// overwrites existing env variables
$dotenv->overload(__DIR__.'/.env');

// loads .env, .env.local, and .env.$APP_ENV.local or .env.$APP_ENV
$dotenv->loadEnv(__DIR__.'/.env');

Resources