Download the PHP package phossa2/env without Composer
On this page you can find all versions of the php package phossa2/env. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package env
Short Description Library to load environments from a shell style file.
License MIT
Homepage https://github.com/phossa2/env
Informations about the package env
phossa2/env [ABANDONED]
PLEASE USE phoole/env library instead
phossa2/env is a library to load environment variables from fully bash shell compatible files.
It requires PHP 5.4, supports PHP 7.0+ and HHVM. It is compliant with PSR-1, PSR-2, PSR-4.
Installation
Install via the composer
utility.
or add the following lines to your composer.json
Usage
-
Put your environments in file
.env
, - Load and use your env variables in PHP script
Features
-
Compatible with bash if not using extended features like get current dir and file or PHP globals.
-
Support shell default values,
${param:-new}
or${param:=new}
-
Able to
source another_env_file
in the env file -
By default, WILL overwrite any existing environment variables. This is the default behavior in bash.
To disable overwrite and honor existing env variables,
-
Get current path, dir, filename with
${BASH_SOURCE}
,${BASH_SOURCE%/*}
,${BASH_SOURCE##*/}
or with
${__PATH__}
,${__DIR__}
,${__FILE__}
, which is not compatible with bash script. -
Support PHP global variables like
$_SERVER
etc.This is not compatible with shell script, thus NOT recommended.
-
Support PHP 5.4+, PHP 7.0+, HHVM
-
PHP7 ready for return type declarations and argument type declarations.
- PSR-1, PSR-2, PSR-4 compliant.
Change log
Please see CHANGELOG from more information.
Testing
Contributing
Please see CONTRIBUTE for more information.
Dependencies
-
PHP >= 5.4.0
- phossa2/shared >= 2.0.21