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

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

alkurn/yii2-dotenv
==================

PHP DotEnv for Yii2 framework

01PHP

Since Oct 25Pushed 4y ago1 watchersCompare

[ Source](https://github.com/alkurn/yii2-dotenv)[ Packagist](https://packagist.org/packages/alkurn/yii2-dotenv)[ RSS](/packages/alkurn-yii2-dotenv/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#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 alkurn/yii2-dotenv "*"

```

or add

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

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/485ae3b1c7496e2d8d100c7c12274e3e7d490afc132ef1b3a2b2a30f10727e1e?d=identicon)[gmankar](/maintainers/gmankar)

---

Top Contributors

[![TechAlkurn](https://avatars.githubusercontent.com/u/56467158?v=4)](https://github.com/TechAlkurn "TechAlkurn (1 commits)")

### Embed Badge

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

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

###  Alternatives

[js-phpize/js-phpize

Convert js-like syntax to standalone PHP code.

23402.4k3](/packages/js-phpize-js-phpize)

PHPackages © 2026

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