Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 902 Bytes

README.md

File metadata and controls

40 lines (29 loc) · 902 Bytes

xdg/dotenv

codecov

PHP implementation of the POSIX-compliant dotenv file format specification.

Installation

composer require xdg/dotenv

Usage

Loading environment variables from a set of dotenv files:

use Xdg\Dotenv\XdgDotenv;

$env = XdgDotenv::load([
    __DIR__ . '/.env',
    __DIR__ . '/.env.local',
]);
// $env is an associative array containing the loaded variables.
var_dump($env);

If you want to evaluate the dotenv files without loading them into the environment, use the following:

use Xdg\Dotenv\XdgDotenv;

$env = XdgDotenv::evaluate([
    __DIR__ . '/.env',
    __DIR__ . '/.env.local',
]);
// $env is an associative array containing the loaded variables.
var_dump($env);