Dotenv
class Dotenv
Manages .env files.
Constants
VARNAME_REGEX | |
STATE_VARNAME | |
STATE_VALUE |
Methods
load($path) Loads one or several .env files. | ||
populate(array $values) Sets values as environment variables (via putenv, $ENV, and $SERVER). | ||
array | parse(string $data, string $path = '.env') Parses the contents of an .env file. |
Details
load($path)
Loads one or several .env files.
Parameters
$path |
Exceptions
FormatException | when a file has a syntax error |
PathException | when a file does not exist or is not readable |
populate(array $values)
Sets values as environment variables (via putenv, $ENV, and $SERVER).
Note that existing environment variables are not overridden.
Parameters
array | $values | An array of env variables |
array parse(string $data, string $path = '.env')
Parses the contents of an .env file.
Parameters
string | $data | The data to be parsed |
string | $path | The original file name where data where stored (used for more meaningful error messages) |
Return Value
array | An array of env variables |
Exceptions
FormatException | when a file has a syntax error |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Dotenv/Dotenv.html