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 4ee85e8e3b Merge branch '5.1'
* 5.1:
  Enable "native_constant_invocation" CS rule
  Make AbstractPhpFileCacheWarmer public
  Fix CS
  Add a warning comment on ldap empty password
  Bump Symfony version to 4.4.14
  Update VERSION for 4.4.13
  Update CHANGELOG for 4.4.13
  [PhpunitBridge] Fix deprecation type detection
2020-09-02 18:27: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 Use ">=" for the "php" requirement 2020-07-05 11:39:30 +02:00
Dotenv.php Merge branch '4.4' into 5.1 2020-09-02 18:23:27 +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