Skip to content

symfony/dotenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

28347a8 · Nov 27, 2024
Sep 25, 2024
Nov 27, 2024
Jun 20, 2024
Sep 28, 2024
Jul 6, 2024
Jan 12, 2017
Nov 20, 2023
Sep 28, 2024
Jan 24, 2023
Dec 8, 2023
May 23, 2023
Jun 2, 2021

Repository files navigation

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