wearesho-team/yii2-dotenv

Yii2 DotEnv File Support

1.3.5 2020-06-17 02:45 UTC

This package is auto-updated.

Last update: 2024-04-16 03:26:01 UTC


README

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