nasermekky / config_manager
v1.1
2024-04-09 04:15 UTC
This package is auto-updated.
Last update: 2024-09-09 05:33:24 UTC
README
在配置文件和语言文件中添加或编辑键值对。并在脚本中保存对配置文件的更改。
安装
使用 Composer 安装 composer require nasermekky/config-manager。
使用 GUI
您可以使用链接 'http://your-site.com/configs'。
使用仓库
您还可以使用仓库 Nasermekky\ConfigManager\Core\Repo,它的工作方式类似于模型。
示例
use Nasermekky\ConfigManager\Core\Repo;
$config = new Repo(config_path('app')); // Pass full path for file with extension or without
// $lang = new Repo(lang_path('en/auth'));
$config->edit('debug', false); // set the config you wish
if ($config->get('url') == 'https://') // you can even get config from this
{
$config->add('key', 'value'); // add key to config file
$config->edit('debug', true); // add key to config fil
$config->delete('key', 'value'); // delete key from config file
// all will return true or Exception
}
// save those settings to the config file once done editing
如果您经常这样做,我建议在配置文件 config/app.php 的 alias 部分添加别名 'ConfigManager' => Nasermekky\ConfigManager\Core\Repo::class。