nigr / dotenv
for parsing .env files
dev-master
2025-12-28 09:13 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpunit/phpunit: ^10.5
This package is auto-updated.
Last update: 2026-03-28 09:54:51 UTC
README
Install library:
composer require nigr/dotenv:@dev
Call function than parsed ENV-file:
use Nigr/Dotenv; $dotenv = new Dotenv(); $dotenv->parse();
If file locates not in root folder, pass as argument path to file in function envPasre():
$dotenv = new Dotenv(); $dotenv->parse("/env/.env.dev");
For call variable, can use $_ENV, $_SERVER and getenv():
$_ENV['DB_USER']; $_SERVER['DB_HOST']; getenv('DB_PORT');