Skip to content

sabroan/php-dotenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dotenv

A simple and tiny PHP .env loader, which does not inject values into $_ENV or OS.

Installation

composer require env/dotenv

Usage

The .env file should have a valid .ini syntaxis, supported by parse_ini_file.

This package does not inject values into global $_ENV or OS wia putenv() so it's up to you how you wan't proceed with parsed data.

Load

Parse .env and get values as array:

$env = \Env\Dotenv::toArray(
    path: '.env',
    strict: false, // by default: true
);

If you need variables and fallback values, set strict to false

About

A simple, tiny and lightweight PHP .env loader

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages