nigr/dotenv

for parsing .env files

Maintainers

Package info

github.com/Reservoir-PHP/nigr-dotenv

pkg:composer/nigr/dotenv

Statistics

Installs: 5

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

dev-master 2025-12-28 09:13 UTC

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');