phpmob/settings-bundle
Composer 安装命令:
composer require phpmob/settings-bundle
包简介
Just a Symfony settings bundle.
README 文档
README
Just a Settings Library.
Installation
Install via composer.
$ composer require phpmob/settings-bundle
Using with cache
$ composer require cache/filesystem-adapter
Now you can use built-in \PhpMob\Settings\Manager\CachedManager.
Alternative using built-int symfony framework cache see - framework/cache
Sample config
# use with doctrine orm doctrine: orm: mappings: PhpMobSettings: type: xml is_bundle: false prefix: PhpMob\Settings\Model dir: '%kernel.project_dir%/vendor/phpmob/settings-bundle/src/Resources/config/doctrine/model' phpmob_settings: cache: service: cache.flysystem schemas: section1: label: Section1 settings: key1: ~ section2: label: Section2 settings: key1: value: key1Value key2: label: SectionKey2 value: key2value blueprint: options: label: SectionKey2Label constraints: NotBlank: ~ gender: label: Gender value: f blueprint: type: Symfony\Component\Form\Extension\Core\Type\ChoiceType options: required: true choices: Man: m Feman: f birthday: type: date label: Birthday value: "1988-02-10" blueprint: type: Symfony\Component\Form\Extension\Core\Type\BirthdayType datetime: type: datetime label: DateTime value: ~ blueprint: type: Symfony\Component\Form\Extension\Core\Type\DateTimeType
Ownered settings
Configuration for owner (user) aware settings. Controller used PhpMobSettingsBundle:Update:userUpdate.
phpmob_settings: schemas: section1: owner_aware: true label: Section1 settings: key1: ~
Updater Routing
See example routing in src/Resources/config/routing.xml or you can customize with:
your_route_name: path: /settings/{section} defaults: _controller: PhpMobSettingsBundle:Update:globalUpdate _template: @yourtemplate # default @PhpMobSetting/default.html.twig _flash: ~ # flash message after update _redirect: ~ # redirect after update
Custom form type to display description setting in form view.
<?php namespace YourBundle\Form\Type; use PhpMob\SettingsBundle\Form\Type\AbstractBlueprintType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; class YourSettingType extends AbstractBlueprintType { /** * {@inheritdoc} */ public function getParentType(): string { return CheckboxType::class; } }
And in setting configuration.
phpmob_settings: schemas: section1: owner_aware: true label: Section1 settings: key1: type: boolean label: 'Key 1' value: true blueprint: type: YourBundle\Form\Type\YourSettingType
using in twig
Getter setting
{{ settings_get('section.key') }}
{# owner aware setting #}
{{ settings_get('section.key', app.user) }}
Setter setting
{{ settings_set('section.key', 'value') }}
{# owner aware setting #}
{{ settings_set('section.key', 'value', app.user) }}
Sample Admin Screen
Contributing
Would like to help us and build the developer-friendly php code? Just follow our Coding Standards and test your code — see tests, spec.
Let Fork and PR now!
Coding Standards
When contributing code to PhpMob, you must follow its coding standards.
PhpMob follows the standards defined in the PSR-0, PSR-1 and PSR-2 documents.
$ ./bin/ecs check src --fix
Tests
$ ./bin/phpunit
LICENSE
phpmob/settings-bundle 适用场景与选型建议
phpmob/settings-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 113.21k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2017 年 10 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「Settings」 「settings-bundle」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 phpmob/settings-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phpmob/settings-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 phpmob/settings-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Persistent settings package for Laravel framework.
A Zend Framework module to quickly and easily set PHP settings.
Settings Card for Laravel Nova.
Just a Symfony settings bundle.
Extends basic Wordpress features.
A Symfony Bundle for easy configuration management
统计信息
- 总下载量: 113.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 2
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-04
