swavel/settisizer
Composer 安装命令:
composer require swavel/settisizer
包简介
Easy implementable package to handle application settings for different scopes with flexible storage places
README 文档
README
A nice little package to set and get settings on different scopes. In the current state, you can define settings for a eloquent model (which defines the scope) and general settings (which are always in always in the global scope). There are, or at least will be, different drivers, so your settings can be stored everywhere you want. Yay!
Installation
composer require swavel/settisizer
Holy shit, that was easy! Now let's go
Usage
In a model
The only thing you have to do to use the settisizer in a model (besides to include it in your composer dependencies) is to use the trait in the class like this:
<?php namespace Your\Awesome\Proiject
class Fu extends Model {
use Settisizable;
[...]
with that given, you just can use it in every instance of that class:
$u = User::find(42);
$u->setSetting([settingname], [settingvalue]);
[...]
$u->getSetting([settingname]);
should there be no value stored for the requested setting, don't you worry child, we cover you there! No errors, just a sober null which will be returned. Yay again!
Globaly
In the status quo, one have to have a instance of a concretion of a Settisizer Class, which is, at the moment, always is one of the SettisizerStorage class.
$settisizer = new SettisizerStorage();
$settisizer->setSetting([globalsettingname], [settingvalue]);
[...]
$settisizer->getSetting([globalsettingname]);
To manage your own config. Run this command.
php artisan vendor:publish --provider=Settisizer\SettisizerServiceProvider
Developer hints
Run phpUnit tests with ../../../vendor/bin/phpunit
Roadmap
Next steps
- Comment the whole thing
- Facade to access global Settisizer with
- name the settings-table for driver mysql
<?php
Settisizer::getSetting('setting_name')
In progress
27.03.2018
- Write a second driver (mysql, redis)
Done
27.03.2018
- Integrate publish function to write standard config file (to select different drivers)
swavel/settisizer 适用场景与选型建议
swavel/settisizer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 11 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 swavel/settisizer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 swavel/settisizer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-15