A simple and tiny PHP .env
loader, which does not inject values into $_ENV
or OS.
composer require env/dotenv
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.
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