deepn9x / yii2-env
DOT-ENV
1.0.1
2024-01-29 10:21 UTC
Requires
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2024-09-29 14:01:49 UTC
README
DOT-ENV
安装
安装此扩展的首选方法是通过composer。
在配置文件夹中创建 .env 文件
首先在 composer.json 中添加链接
{
"type": "git",
"url": "https://github.com/deepn9x/yii2-env"
}
要么运行
composer require deepn9x/yii2-env
或者添加
"deepn9x/yii2-env": "1.0"
到你的 composer.json
文件的 require 部分。
用法
一旦扩展被安装,只需在代码中通过
<?= \deepn9x\env\dotenv($key); ?>``` or add to web.php in components
'dotenv' => [ 'class' => deepn9x\env\dotenv::class ],
Using examples
$example_1 = Yii::$app->dotenv->key("KEY");
$example_2 = new dotenv("ISP_KEY");