sitesoft / laravel-config-writer
配置扩展
v1.0
2017-03-23 10:44 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2024-09-28 20:30:34 UTC
README
将配置文件写入 Laravel 并维护文件完整性。
这个库是 Laravel 使用的 Config 组件的扩展。它增加了写入配置文件的能力。
您可以在返回单个数组定义的基本配置文件中重写数组值(例如 Laravel 配置文件),同时保持文件完整性,保留注释和高级设置。
支持以下值类型进行写入:字符串、整数、布尔值和单维数组。
使用说明
将此添加到 app/config/app.php 中的 'providers' 键下
'October\Rain\Config\ConfigServiceProvider',
Laravel 之外的使用
Rewrite 类可以在任何地方使用。
$writeConfig = new October\Rain\Config\Rewrite; $writeConfig->toFile('path/to/config.php', [ 'item' => 'new value', 'nested.config.item' => 'value', 'arrayItem' => ['Single', 'Level', 'Array', 'Values'], 'numberItem' => 3, 'booleanItem' => true ]);