thetispro/laravel5-setting 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thetispro/laravel5-setting

Composer 安装命令:

composer require thetispro/laravel5-setting

包简介

Persistent configuration settings for Laravel 5 - Create, Read, Update and Delete settings stored in files using JSON

README 文档

README

Build Status

Laravel 5 Setting

##Introduction This package is a fork of philf/setting, updated to work with Laravel 5.x.

##Description Persistent configuration settings for Laravel 5.x - Create, Read, Update and Delete settings stored in files using JSON.

As Philf said :

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 base_path().'/storage/meta/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

For philf/setting: janhartigan (Treeface) Nils Plaschke (Chumper)

##Laravel 4.x users Please use philf/setting

Installation

Require this package in your composer.json:

For Laravel 5 -> 5.3

"thetispro/laravel5-setting": "1.0.x-dev"

For Laravel 5.4

    "thetispro/laravel5-setting": "1.1.x-dev"

Add the ServiceProvider to the 'providers' array in config/app.php

'providers' => [
// ... Illuminate Providers
// ... App 
Thetispro\Setting\SettingServiceProvider::class,
],

If you want to use the facade, add the alias to the 'aliases' array in config/app.php

'aliases' => [
// ... Illuminate Facades    
'Setting' => Thetispro\Setting\Facades\Setting::class,
]

Finaly, publish the config file

$ php artisan vendor:publish

Usage

No other change from philf/setting;

##Config

return array(
'path'     => base_path('storage/meta'),
'filename' => 'setting.json',
'fallback' => 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 5 Setting is open-sourced software licensed under the MIT license

thetispro/laravel5-setting 适用场景与选型建议

thetispro/laravel5-setting 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.66k 次下载、GitHub Stars 达 25, 最近一次更新时间为 2015 年 08 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「config」 「laravel」 「setting」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 thetispro/laravel5-setting 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 thetispro/laravel5-setting 我们能提供哪些服务?
定制开发 / 二次开发

基于 thetispro/laravel5-setting 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 28
  • 点击次数: 26
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 25
  • Watchers: 3
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-08