alverated/config

dev-master 2016-05-17 13:33 UTC

This package is auto-updated.

Last update: 2024-08-29 04:19:50 UTC


README

写入 Laravel 配置文件并维护文件完整性。

该库是 Laravel 使用的 Config 组件的扩展。它增加了写入配置文件的能力。

您可以在返回单个数组定义的基本配置文件(如 Laravel 配置文件)内部重写数组值,同时保持文件完整性,保留注释和高级设置。

支持的写入值类型包括:字符串、整数和布尔值。

使用说明

将以下内容添加到 app/config/app.php 中的 'providers' 键下

'October\Rain\Config\ConfigServiceProvider',

现在您可以写入配置文件

Config::write('app.url', 'http://octobercms.com');

Laravel 之外的使用

Rewrite 类可以在任何地方使用。

$writeConfig = new October\Rain\Config\Rewrite;
$writeConfig->toFile('path/to/config.php', [
    'item' => 'new value',
    'nested.config.item' => 'value'
]);

原始仓库

https://github.com/daftspunk/laravel-config-writer