PHPackages                             dimanzver/yii2-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. dimanzver/yii2-dotenv

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

dimanzver/yii2-dotenv
=====================

PHP DotEnv for Yii2 framework

1.0.4(2y ago)03.9kMITPHPPHP ^7.4 || ^8.0

Since Jan 22Pushed 2y agoCompare

[ Source](https://github.com/dimanzver/yii2-dotenv)[ Packagist](https://packagist.org/packages/dimanzver/yii2-dotenv)[ RSS](/packages/dimanzver-yii2-dotenv/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (6)Used By (0)

Yii2 DotEnv
===========

[](#yii2-dotenv)

[![Build Status](https://camo.githubusercontent.com/b5213edefbac047fc71e8761e65293817b2bf5495b1158fdbf6c191f82c884f3/68747470733a2f2f7472617669732d63692e6f72672f64696d616e7a7665722f796969322d646f74656e762e737667)](https://travis-ci.org/dimanzver/yii2-dotenv)[![Latest Stable Version](https://camo.githubusercontent.com/6926994ae69347265079cc19842c1be5a82c16f100610c9b9284ab43d17efbf9/68747470733a2f2f706f7365722e707567782e6f72672f64696d616e7a7665722f796969322d646f74656e762f762f737461626c652e737667)](https://packagist.org/packages/dimanzver/yii2-dotenv)[![Total Downloads](https://camo.githubusercontent.com/b7ad71fd6a47d39a94be03b5086c9bd71ed4a85dfb0633c526e6e95aaeb067d8/68747470733a2f2f706f7365722e707567782e6f72672f64696d616e7a7665722f796969322d646f74656e762f646f776e6c6f6164732e737667)](https://packagist.org/packages/dimanzver/yii2-dotenv)[![Latest Unstable Version](https://camo.githubusercontent.com/06e325bc68c8225c707f482692744cdcbadd84433bd2b0586d1d77dadb5eb2c5/68747470733a2f2f706f7365722e707567782e6f72672f64696d616e7a7665722f796969322d646f74656e762f762f756e737461626c652e737667)](https://packagist.org/packages/dimanzver/yii2-dotenv)[![License](https://camo.githubusercontent.com/1902feff48671322e267d4609b5f7306e6ada6cc5449f00f965d1d43575af651/68747470733a2f2f706f7365722e707567782e6f72672f64696d616e7a7665722f796969322d646f74656e762f6c6963656e73652e737667)](https://packagist.org/packages/dimanzver/yii2-dotenv)

PHP DotEnv for Yii2 framework.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist dimanzver/yii2-dotenv "*"

```

or add

```
"dimanzver/yii2-dotenv": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

```
[
    'db' => [
        'password' => env('DB_PASS'),
    ],
]

```

The env function will autoload .env file, it uses the following search mechanism:

```
If there is a Yii class, then pass the alias @vendor or @app or @yii, Otherwise
according to the project directory to determine.

```

But, if your application vendor directory is a symbol link and you no registered @vendor or @app alias before call env function, the project will not working. So you should set the @vendor alias before calling env function.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 68.8% 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 ~512 days

Total

5

Last Release

984d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.5.0

1.0.3PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/006e8107d5fbf667c096b1166b783731b29c76de4763430d12579595010cb539?d=identicon)[dimanzver](/maintainers/dimanzver)

---

Top Contributors

[![panlatent](https://avatars.githubusercontent.com/u/4393268?v=4)](https://github.com/panlatent "panlatent (11 commits)")[![Webkadabra](https://avatars.githubusercontent.com/u/1168612?v=4)](https://github.com/Webkadabra "Webkadabra (3 commits)")[![dimansuvorlinda](https://avatars.githubusercontent.com/u/34809155?v=4)](https://github.com/dimansuvorlinda "dimansuvorlinda (1 commits)")[![dimanzver](https://avatars.githubusercontent.com/u/50018287?v=4)](https://github.com/dimanzver "dimanzver (1 commits)")

---

Tags

dotenvyii2extension

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[yiithings/yii2-dotenv

PHP DotEnv for Yii2 framework

40574.5k7](/packages/yiithings-yii2-dotenv)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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