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.
统计信息
- 总下载量: 108
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-11