adistoe/env-loader

A loader for environment variables

Maintainers

Package info

github.com/adistoe/EnvLoader

pkg:composer/adistoe/env-loader

Statistics

Installs: 498

Dependents: 1

Suggesters: 0

Stars: 1

Open Issues: 0

1.2.0 2025-10-24 12:29 UTC

This package is auto-updated.

Last update: 2026-02-24 13:05:40 UTC


README

A PHP class to load environment variables from .env files

Installation

Install it using composer:

composer require adistoe/env-loader

Getting Started

Create a .env file or copy the .env.example (rename it to .env) and modify it as needed.
Then you can load the file with the following code:

EnvLoader::load('path/to/your/project/');

If no .env file exists in the given path, the EnvLoader will automatically search for a .env file in all subdirectories.

If the file is loaded correctly you can access your environment variables with over the php function:

getenv('NAME_OF_THE_VARIABLE');