nigr / dotenv
for parsing .env files
Installs: 5
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/nigr/dotenv
Requires
- php: >=8.1
Requires (Dev)
- phpunit/phpunit: ^10.5
This package is auto-updated.
Last update: 2025-12-28 09:13:20 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');