WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

php-xdg/dotenv

Repository files navigation

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);

Releases

No releases published

Packages

No packages published

Languages