phant/env

Manage env easily

Maintainers

Package info

github.com/PhantPHP/env

pkg:composer/phant/env

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0 2022-10-06 14:07 UTC

This package is auto-updated.

Last update: 2026-03-06 21:35:13 UTC


README

Presentation

The environment variable manager makes it easy to manipulate your environment variables in your projects.

Installation

composer require phant/env

Technologies used

  • PHP 8.1
  • Composer for dependencies management (PHP)

Usage

Get

If the variable is not defined, an exception will be thrown.

use Phant\Env\Manager as Env;

echo Env::get('MY_VAR');

Get with default value

use Phant\Env\Manager as Env;

echo Env::get('MY_VAR', 'default value');

Set

If the variable is already defined, an exception will be thrown.

use Phant\Env\Manager as Env;

echo Env::set('MY_VAR', 'my new value');

Set value on existing var

use Phant\Env\Manager as Env;

echo Env::set('MY_VAR', 'my new value', true);