munna/dot-env-editor
Composer 安装命令:
composer require munna/dot-env-editor
包简介
Simple package for laravel .env file modification. Now you can handle your .env variable easily.
README 文档
README
Dot Env Editor
Laravel .env File Moderator
Installing DotEnvEditor
Next, run the Composer command to install the latest stable version:
composer require munna/dot-env-editor
##After installing, you should follow these two step:
Add this provider link at your config/app.php file into the providers array.
Munna\DotEnvEditor\DotEnvEditorServiceProvider::class,
And
Add this facades link at your config/app.php file into the aliases array.
'DotEnvEditor' => Munna\DotEnvEditor\Facades\DotEnvEditor::class,
Create A Class Instance
to create a class instance
use Munna\DotEnvEditor\DotEnvEditor; $env = new DotEnvEditor(); $env->env_array(); // Use this class as your demand.
You can use direct
When you are already set the facade class into your aliases array at the config/app.php file.
use DotEnvEditor; $env_array = DotEnvEditor::env_array(); // Example
Get The All Variable As Array
use DotEnvEditor; $env_array = DotEnvEditor::env_array();
Get The Key Value
use DotEnvEditor; $key = "APP_NAME"; $key_val = DotEnvEditor::env_key($key);
Check The Key Is Exists or Not
use DotEnvEditor; $key = "APP_NAME"; $key_check = DotEnvEditor::env_key_check($key);
Add a new key
use DotEnvEditor; $key = "NEW_KEY"; $value = "NEW_VALUE"; // or 1254 or https://www.domain.com $add_key = DotEnvEditor::add_key($key, $value);
Add a new key after any one of existing key
use DotEnvEditor; $key = "NEW_KEY"; $value = "NEW_VALUE"; $existing_key = "EXISTING_KEY"; $add_key_after = DotEnvEditor::add_key_after($key, $value, $existing_key);
Add a new key before any one of existing key
use DotEnvEditor; $key = "NEW_KEY"; $value = "NEW_VALUE"; $existing_key = "EXISTING_KEY"; $add_key_before = DotEnvEditor::add_key_before($key, $value, $existing_key);
Update the existing key
use DotEnvEditor; $key = "EXISTING_KEY"; $value = "NEW_VALUE"; $update_key = DotEnvEditor::update_key($key, $value);
Update multiple existing key
$array = [ "APP_NAME" => "TEST_LARAVEL_APP", "MAIL_USERNAME" => "TEST_MAIL_USERNAME", "MAIL_PASSWORD" => "TEST_MAIL_PASSWORD", ]; $env = DotEnvEditor::update_multiple_key($array); return $env;
Remove the existing key
use DotEnvEditor; $key = "EXISTING_KEY"; $remove_key = DotEnvEditor::remove_key($key);
Full Env File As An Indexing Array
use DotEnvEditor; $env_array = DotEnvEditor::env_file();
Env Row File As String
use DotEnvEditor; $env_row_file = DotEnvEditor::env_row_file();
License
This package is open-sources and licensed under the MIT license.
Thank you very much. Please give a star.
munna/dot-env-editor 适用场景与选型建议
munna/dot-env-editor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 108 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 01 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 munna/dot-env-editor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 munna/dot-env-editor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 108
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 4
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-11