Search by

codebot / phpenv

This package is abandoned and no longer maintained. No replacement package was suggested.

Class for storing and reading environment variables from .env file stored in document root.

Maintainers

Package info

github.com/hakobyansen/phpenv

pkg:composer/codebot/phpenv

Transparency log

Statistics

Installs: 556

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.4 2020-11-19 17:56 UTC

This package is auto-updated.

Last update: 2026-09-01 15:55:27 UTC


README

Class for storing and reading environment variables from ".env" file.

Installation

To install the package using composer run composer require codebot/phpenv:1.0.*

Usage

You need to create the ".env" file in your project root and define your environment variables there.
Project root is the directory returned by $_SERVER['DOCUMENT_ROOT'] variable.
If you want to store the .env file somewhere else, you can pass the full path of your .env file as a first argument of getInstance() method, e.g. Env\Core\Env::getInstance( '/path/to/.env' ).

Example of the .env file:

# Test .env file
APP_NAME=The Phpenv Package
APP_ENV=local

Example of the usage:

$env = Env\Env::getInstance();

$env->get('APP_ENV');