2.0.3 2025-04-21 18:17 UTC

This package is auto-updated.

Last update: 2025-04-21 18:17:45 UTC


README

This class is used for loading and parsing environment variables from a file.

Install

composer require krzysztofzylka/env

Load env file

$env = new \Krzysztofzylka\Env\Env();
$env->loadFromFile('/path/to/env/file');

Load multiple env file

$env = new \Krzysztofzylka\Env\Env();
$env->loadFromFile(['/path/to/env/file', '/path/to/env/file', ...]);

Load from system (getenv())

$env = new \Krzysztofzylka\Env\Env();
$env->loadFromSystem();

Example ENV file content

DB_HOST=localhost
DB_NAME=testDB
DB_USER=username
DB_PASS=password

Exceptions

File not found: If the given file path does not exist a File not found exception will be thrown.