PHPackages                             quillstack/dotenv - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. quillstack/dotenv

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

quillstack/dotenv
=================

The library for using .env files.

v0.0.6(4y ago)12001MITPHPPHP ^8.0

Since Aug 10Pushed 4y agoCompare

[ Source](https://github.com/quillstack/dotenv)[ Packagist](https://packagist.org/packages/quillstack/dotenv)[ Docs](https://quillstack.org/dotenv)[ RSS](/packages/quillstack-dotenv/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (6)Dependencies (2)Versions (7)Used By (1)

Quillstack Dotenv
=================

[](#quillstack-dotenv)

[![Build Status](https://camo.githubusercontent.com/d190d9d3e7521cdad344b22ffccfdea1f4ef65633059663102209bbd1726eb0e/68747470733a2f2f6170702e7472617669732d63692e636f6d2f7175696c6c737461636b2f646f74656e762e7376673f6272616e63683d6d61696e)](https://app.travis-ci.com/quillstack/dotenv)[![Downloads](https://camo.githubusercontent.com/9e5857dd1fb636c68afd9dcc33628ba22061bc6d6ea8f6374a8f54cf1f47c066/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7175696c6c737461636b2f646f74656e762e737667)](https://packagist.org/packages/quillstack/dotenv)[![Coverage](https://camo.githubusercontent.com/ba0fc5e46ceecd9a5ef20a0e4730bb6b12921bf4a37864c171bb3d9ef28b8982/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7175696c6c737461636b5f646f74656e76266d65747269633d636f766572616765)](https://sonarcloud.io/dashboard?id=quillstack_dotenv)[![Lines of Code](https://camo.githubusercontent.com/de7db1315f1cef5275d00dadd2127c95bc7309d80e55bdbb0ab38c7803c326d9/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7175696c6c737461636b5f646f74656e76266d65747269633d6e636c6f63)](https://sonarcloud.io/dashboard?id=quillstack_dotenv)[![StyleCI](https://camo.githubusercontent.com/85c9d39d25b1084d468b80ccede39aaa23de272e10a987bff6f961792fa4e27b/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3330333531303734382f736869656c643f6272616e63683d6d61696e)](https://github.styleci.io/repos/303510748?branch=main)[![CodeFactor](https://camo.githubusercontent.com/502523dbf921396b4c820cc49917aa82abdf4ed0dbf3b9382daeb188251797cc/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f7175696c6c737461636b2f646f74656e762f6261646765)](https://www.codefactor.io/repository/github/quillstack/dotenv)[![Packagist License](https://camo.githubusercontent.com/ec26626646ffd34f558dd1298ca01ab5ead4fad195b69c24341c398b5130ab34/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7175696c6c737461636b2f646f74656e76)](https://camo.githubusercontent.com/ec26626646ffd34f558dd1298ca01ab5ead4fad195b69c24341c398b5130ab34/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7175696c6c737461636b2f646f74656e76)[![Reliability Rating](https://camo.githubusercontent.com/d383a30047c86f9ea79fb6d13bca4a0f976799c06d654f1c5af44fb5095a22e2/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7175696c6c737461636b5f646f74656e76266d65747269633d72656c696162696c6974795f726174696e67)](https://sonarcloud.io/dashboard?id=quillstack_dotenv)[![Maintainability](https://camo.githubusercontent.com/eabb94cb0cc44682c91f200003898732fb15cba6066b1856eff51756e0806b62/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f64663232306132363663363666356234633139632f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/quillstack/dotenv/maintainability)[![Security Rating](https://camo.githubusercontent.com/b950c74e14bdddceb558ea0457e91c3ddb5c3b5dcdb4ef469cd76dcc04c7daf4/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7175696c6c737461636b5f646f74656e76266d65747269633d73656375726974795f726174696e67)](https://sonarcloud.io/dashboard?id=quillstack_dotenv)[![Packagist PHP Version Support](https://camo.githubusercontent.com/870c36507959329acc135d4e0d43a3cc3f4bb09c5121445339a984984c3c2dc3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7175696c6c737461636b2f646f74656e76)](https://camo.githubusercontent.com/870c36507959329acc135d4e0d43a3cc3f4bb09c5121445339a984984c3c2dc3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7175696c6c737461636b2f646f74656e76)

The library for using `.env` files. You can find the full documentation on the website:

The `.env` should be used for sensitive information like passwords, hosts, keys, credentials, and all other values that can be changed depending on the environment, e.g., debug mode settings or logs level.

### Installation

[](#installation)

To install this package, run the standard command using *Composer*:

```
composer require quillstack/dotenv
```

### Usage

[](#usage)

You can use Quillstack Dotenv package when you want to use `.env` files in your project.

#### Simple usage

[](#simple-usage)

If you created the `.env` file in the root directory of your proejct:

```
APP_DEBUG=true
```

You can load this `.env` file in your application:

```
$dotenv = new Dotenv('.env');
$dotenv->load();
```

Every time you need to know if your application works in debug mode, you can check it using this helper function:

```
if (env('APP_DEBUG')) {
    echo 'Debug mode';
}
```

#### Default values

[](#default-values)

You can also define a default value depending on the context:

```
if (env('APP_DEBUG', false)) {
    echo 'Debug mode';
}
```

#### Required keys

[](#required-keys)

You can use another helper method for required keys. If required key is not found an exception will be thrown:

```
$dbHost = required('DATABASE_HOST');
```

The result if the key `DATABASE_HOST` is not set in the `.env` file:

```
DotenvValueNotSetException:
Value not set for key: DATABASE_HOST

```

#### Multi-line values

[](#multi-line-values)

You can define multi-line values in your `.env` file by using `\n` separator instead of new lines for example:

```
PRIVATE_KEY="line1\nline2\nline3"

```

### Unit tests

[](#unit-tests)

Run tests using a command:

```
phpdbg -qrr ./vendor/bin/unit-tests
```

### Docker

[](#docker)

```
$ docker-compose up -d
$ docker exec -w /var/www/html -it quillstack_dotenv sh
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Total

6

Last Release

1585d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2fa2ce7331aba0b089a6397b0f2304a912963d7bd6b2fdda457864abdfd810ec?d=identicon)[radek-ziemniewicz](/maintainers/radek-ziemniewicz)

---

Top Contributors

[![radek-ziemniewicz](https://avatars.githubusercontent.com/u/44390595?v=4)](https://github.com/radek-ziemniewicz "radek-ziemniewicz (19 commits)")

---

Tags

dotenvenvenvironmentphpphp8quillstackphpenvironmentenvdotenvphp8quillstack

### Embed Badge

![Health badge](/badges/quillstack-dotenv/health.svg)

```
[![Health](https://phpackages.com/badges/quillstack-dotenv/health.svg)](https://phpackages.com/packages/quillstack-dotenv)
```

###  Alternatives

[vlucas/phpdotenv

Loads environment variables from `.env` to `getenv()`, `$\_ENV` and `$\_SERVER` automagically.

13.5k602.4M5.4k](/packages/vlucas-phpdotenv)[zepgram/magento-dotenv

Simple autoloader to integrate the Symfony Dotenv component into Magento2

1371.3k](/packages/zepgram-magento-dotenv)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
