wearesho-team / yii2-dotenv
Yii2 DotEnv File Support
Installs: 42
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 2
pkg:composer/wearesho-team/yii2-dotenv
Requires
- php: >=7.4
- vlucas/phpdotenv: ^5.0
- yiisoft/yii2: ^2.0.35
Requires (Dev)
- phpunit/phpunit: ^9.2
- squizlabs/php_codesniffer: ^3.5
README
Yii2 Support for loading environment variables from DotEnv files using vlucas/phpdotenv. Required PHP >=7.4.
Installation
composer require wearesho-team/yii2-dotenv:^1.2
Usage
This package includes Bootstrap.
You need to prepend it to application bootstrap list:
<?php use Wearesho\Yii2\DotEnv; return [ 'id' => 'app', 'bootstrap' => [ DotEnv\Bootstrap::class, // ... other bootstraps ], 'components' => [ // ... components definitions ], ];
Environment Constants
You should set environment variables YII_ENV and YII_DEBUG.
It will be used to define Yii2 constants:
YII_ENV(prod/dev/test), defaultdevYII_DEBUG(0/1), default1(true)
See autoload file constants.php for details.