Nicolas Grekas 23bd13cf3f Merge branch '7.4' into 8.0
* 7.4:
  [WebProfilerBundle] Cleanup whitespace
  [Validator] Regex bypass when match is false with too big input
  gracefully handle the kernel.runtime_mode.web parameter missing
  [JsonStreamer] Fix missing generator for shared types in self-referencing objects
  [Mailer] Rewrite "rebanded" to "re-branded"
  [DependencyInjection] Handle Stringable for string-typed arguments in CheckTypeDeclarationsPass
  [DependencyInjection] Fix TypeError when using a custom container base class with typed $parameterBag
  [Dotenv] Defer variable and command expansion to account for overrides from subsequent .env files
  Bump Symfony version to 7.4.7
  Update VERSION for 7.4.6
  Update CHANGELOG for 7.4.6
  Bump Symfony version to 6.4.35
  Update VERSION for 6.4.34
  Update CONTRIBUTORS for 6.4.34
  Update CHANGELOG for 6.4.34
2026-03-03 08:49:33 +01:00
2026-02-13 13:00:38 +01:00
2024-06-20 17:52:34 +02:00
2026-03-03 08:49:33 +01:00
2017-01-12 08:39:44 -08:00
2025-06-20 12:43:44 +02:00
2025-06-03 14:29:50 +02:00
2026-03-03 08:48:48 +01:00
2023-01-24 15:02:46 +01:00
2025-07-31 11:31:17 +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

Usage

For an .env file with this format:

YOUR_VARIABLE_NAME=my-string
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');

// Usage with $_ENV
$envVariable = $_ENV['YOUR_VARIABLE_NAME'];

// Usage with $_SERVER
$envVariable = $_SERVER['YOUR_VARIABLE_NAME'];

Resources

Description
⚠️ ARCHIVED: Original GitHub repository no longer exists. Preserved as backup on 2026-01-22T16:32:32.195Z
Readme MIT 770 KiB
Languages
PHP 100%