Simple library to load and get values from .env
file(s).
composer require murilo-perosa/dot-env
use MuriloPerosa\DotEnv\DotEnv;
// enter path to .env file
(new DotEnv(__DIR__ . '/../.env'))->load();
// php implementation
$value = getenv('YOUR_KEY');
// package implementation
$value = DotEnv::get('YOUR_KEY');
// package implementation with default value
$value = DotEnv::get('YOUR_KEY', 'DEFAULT_VALUE');