small / env
There is no license information available for the latest version (1.0.0) of this package.
small-env is a class to manage env vars for from scratch projects
1.0.0
2023-02-20 11:14 UTC
Requires
- php: >=8.2
Requires (Dev)
- phpunit/phpunit: 9.*
This package is auto-updated.
Last update: 2024-10-23 21:22:33 UTC
README
About
This project intend to manage env vars from system or dot env files
Install
Require the package with composer:
composer require small/env
Usage
Get a env var
$env = new \Small\Env\Env();
$env->get('test');
Note that if var not loaded in class, it will ask system for value and store result in class
Parse a dot env file
$env = new \Small\Env\Env();
$env->parseFile(__DIR__ . '/.env');
echo $env->get('MY_VAR');
Force value from system env var
$env = new \Small\Env\Env();
$env->parseFile(__DIR__ . '/.env');
$env->grabFromSystem('MY_VAR');
echo $env->get('MY_VAR');
test
To run unit tests, use :
$ bin/test --build