originphp/dotenv

OriginPHP DotEnv

2.0.0 2021-01-04 11:26 UTC

This package is auto-updated.

Last update: 2024-11-04 20:40:56 UTC


README

license build coverage

A dotenv parser.

Installation

To install this package

$ composer require originphp/dotenv

Then in your application bootstrap

use Origin\DotEnv\DotEnv;
(new DotEnv())->load(__DIR__);

Here is an example of a dotenv file.

GMAIL_USERNAME=foo@gmail.com
GMAIL_PASSWORD=secret

You can also add export in front of each line so you can source the file with bash.

export GMAIL_USERNAME=foo@gmail.com
export GMAIL_PASSWORD=secret

If you want to use a custom name

use Origin\DotEnv\DotEnv;
(new DotEnv())->load(__DIR__,'.env-local');