minkbear/setting
Composer 安装命令:
composer require minkbear/setting
包简介
Persistent configuration settings for Laravel - Create, Read, Update and Delete settings stored in files using JSON
README 文档
README
Laravel Setting (Laravel 5 package)
Persistent configuration settings for Laravel - Create, Read, Update and Delete settings stored in files using JSON.
This package was the result of me not being able to save new settings to config files in a more persistent way.
This package was designed not to replace the config solution currently offered by Laravel but rather complement it and be used in unison with it.
By default the data is stored in storage_path().'/app/setting.json' but this can be easily changed either in the config file or on the fly in realtime.
This package also provides a fallback for the Laravel Config facade, you can set it in the config, if the key is not found in the json file it will look it up in the Config facade.
Contributors
janhartigan (Treeface)
Nils Plaschke (Chumper)
Installation
Require this package in your composer.json:
"philf/setting": "dev-master"
And add the ServiceProvider to the providers array in app/config/app.php
'minkbear\Setting\SettingServiceProvider',
And publish the config file
php artisan vendor:publish --provider="minkbear\Setting\SettingServiceProvider"
Usage
##Config
return array(
'path' => storage_path().'/app',
'filename' => 'setting.json',
'fallback' => true,
'autoAlias => true,
);
##Fallback capability built in. // Automatic fallback to Laravel config Setting::get('app.locale');
##Single dimension
set: Setting::set('name', 'Phil')
get: Setting::get('name')
forget: Setting::forget('name')
has: Setting::has('name')
#Multi dimensional
set: Setting::set('names.firstName', 'Phil')
set: Setting::set('names.surname', 'F')
or
set: Setting::set('names', array('firstName' => 'Phil', 'surname' => 'F'))
setArray: Setting::setArray(array('firstName' => 'Phil', 'surname' => 'F'))
get: Setting::get('names.firstName')
forget: Setting::forget('names.surname'))
has: Setting::has('names.firstName')
#Array processing
// Get all of the entries in the names array
$names = Setting::get('names');
foreach ($names as $key => $val)
{
...
}
// Get the whole array
$everything = Setting::get();
You can also clear the JSON file with the clear command
clear: Setting::clear()
Using a different path (make sure the path exists and is writable) *
Setting::path(app_path().'/storage/meta/sub')->set('names2', array('firstName' => 'Phil', 'surname' => 'F'));
Using a different filename
Setting::filename('setting2.json')->set('names2', array('firstName' => 'Phil', 'surname' => 'F'));
Using both a different path and filename (make sure the path exists and is writable)
Setting::path(app_path().'/storage/meta/sub')->filename('dummy.json')->set('names2', array('firstName' => 'Phil', 'surname' => 'F'));
License
Laravel Setting is open-sourced software licensed under the MIT license
minkbear/setting 适用场景与选型建议
minkbear/setting 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 08 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「config」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 minkbear/setting 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 minkbear/setting 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 minkbear/setting 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Zend Framework module to quickly and easily set PHP settings.
Server environment detection based on config array-file
Single and multi-dimensional parameter bag with dot-path access for PHP.
Alfabank REST API integration
Laravel provider to be able to rewrite configuration
Advanced configuration manager for PHP with dotted-path access, file/directory/class loaders and a static facade.
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-04