Search by

nigr / dotenv

NikitinVladimirV

for parsing .env files

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

This package is auto-updated.

Last update: 2026-10-31 22:02:04 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');