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

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

inquid/yii2-dotenv
==================

PHP DotEnv for Yii2 framework

1.0.2(8y ago)0251[1 issues](https://github.com/inquid/yii2-dotenv/issues)MITPHPPHP &gt;=5.5.0

Since Jan 22Pushed 4y agoCompare

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

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

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

[](#yii2-dotenv)

[![Build Status](https://camo.githubusercontent.com/ebd1687fcfdfd9ebc45e5ee9465f541fdc8ea369f93800f7bb59fd5ed3816859/68747470733a2f2f7472617669732d63692e6f72672f7969697468696e67732f796969322d646f74656e762e737667)](https://travis-ci.org/yiithings/yii2-dotenv)[![Latest Stable Version](https://camo.githubusercontent.com/0d62886ffc51dd1a49f36bb546f080efc126c81b83764607454bbd35aefc3230/68747470733a2f2f706f7365722e707567782e6f72672f7969697468696e67732f796969322d646f74656e762f762f737461626c652e737667)](https://packagist.org/packages/yiithings/yii2-dotenv)[![Total Downloads](https://camo.githubusercontent.com/371deadeaf631473a9c5f1df89ea5dd8fb92acba31877491494439871d27b0e6/68747470733a2f2f706f7365722e707567782e6f72672f7969697468696e67732f796969322d646f74656e762f646f776e6c6f6164732e737667)](https://packagist.org/packages/yiithings/yii2-dotenv)[![Latest Unstable Version](https://camo.githubusercontent.com/5ef9f8d0e8b6e59eb938a36a459dd74e89eed431b55c3dfd277322665363beb0/68747470733a2f2f706f7365722e707567782e6f72672f7969697468696e67732f796969322d646f74656e762f762f756e737461626c652e737667)](https://packagist.org/packages/yiithings/yii2-dotenv)[![License](https://camo.githubusercontent.com/4725383c8d32386c355e21ff857a5f364b73920d79ad97bb8b14b8a364b644a4/68747470733a2f2f706f7365722e707567782e6f72672f7969697468696e67732f796969322d646f74656e762f6c6963656e73652e737667)](https://packagist.org/packages/yiithings/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 yiithings/yii2-dotenv "*"

```

or add

```
"yiithings/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

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 62.5% 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 ~35 days

Total

3

Last Release

2961d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1505641?v=4)[Luis Gonzalez](/maintainers/gogl92)[@gogl92](https://github.com/gogl92)

---

Top Contributors

[![panlatent](https://avatars.githubusercontent.com/u/4393268?v=4)](https://github.com/panlatent "panlatent (10 commits)")[![gogl92](https://avatars.githubusercontent.com/u/1505641?v=4)](https://github.com/gogl92 "gogl92 (6 commits)")

---

Tags

dotenvyii2extension

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/inquid-yii2-dotenv/health.svg)](https://phpackages.com/packages/inquid-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)
