PHPackages                             cyberinferno/yii2-phpdotenv - 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. cyberinferno/yii2-phpdotenv

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

cyberinferno/yii2-phpdotenv
===========================

phpdotenv Yii2 extension

2.0.1(8y ago)711.0kMITPHPPHP &gt;=5.4.0

Since Jun 26Pushed 8y ago1 watchersCompare

[ Source](https://github.com/cyberinferno/yii2-phpdotenv)[ Packagist](https://packagist.org/packages/cyberinferno/yii2-phpdotenv)[ RSS](/packages/cyberinferno-yii2-phpdotenv/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Phpdotenv extension for Yii 2
=============================

[](#phpdotenv-extension-for-yii-2)

This is a Yii2 extension for [vulcas/phpdotenv](https://github.com/vlucas/phpdotenv)

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

[](#installation)

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

Either run

```
php composer.phar require cyberinferno/yii2-phpdotenv

```

or add

```
"cyberinferno/yii2-phpdotenv": "~2.0.0"
```

to the require section of your composer.json.

Configuration
-------------

[](#configuration)

Usage:

```
return [
    //....
    'bootstrap' => [
        [
            'class' => 'cyberinferno\yii\phpdotenv\Loader',
            'path' => '@vendor/../', // Directory of the .env file
            'file' => '.env', // Optional parameter if custom environment variable file
            'overload' => false, // Optional parameter whether to overload already existing environment variables. Defaults to false
        ],
    ]
];
```

To use components which will access environment variables extend Loader class like this:

```
