Skip to content

wearesho-team/yii2-dotenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 DotEnv

Build Status codecov

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), default dev
  • YII_DEBUG (0/1), default 1 (true)

See autoload file constants.php for details.

License

MIT