escolalms/settings 问题修复 & 功能扩展

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

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

escolalms/settings

Composer 安装命令:

composer require escolalms/settings

包简介

Escola LMS Settings and custom fields management

README 文档

README

Configuration management package

swagger codecov phpunit downloads downloads downloads

Purpose

This package can be used to register application config keys which can be then modified through API and/or Admin Panel.

Installation

  • composer require escolalms/settings
  • php artisan migrate
  • php artisan db:seed --class="EscolaLms\Settings\Database\Seeders\PermissionTableSeeder"
  • optional: php artisan vendor:publish --tag=escola_settings.config to publish config file

Dependencies

Usage

Configuration

Config file contains use_database option, which determines if Config should be written and loaded to database (if true), or config files should be overwritten (if false);

Registering config keys

Every package can register config keys by calling registerConfig static method from AdministrableConfig Facade in its own Package Service Provider register method.

use EscolaLms\Settings\Facades\AdministrableConfig;

public function register(){

    //...

    AdministrableConfig::registerConfig($key = 'config_file.config_key', $rules = ['required', 'string'], $public = true, $readonly = false);

}

When registering a configuration key you can:

  • specify validation rules for values that can be stored (using any of rules available for Laravel validator)
  • specify if key is public (so anonymous users can retrieve the value)
  • specify if key is readonly (so it is returned by API but can not be changed using API)

Loading config

Config will be automatically loaded from database (if use_database config options is true). Otherwise, if overwriting config files is chosen, normal Laravel config loading mechanism is used.

Changing config

EscolaLms\Settings\Facades\AdministrableConfig facade can also be used to modify and retrieve values for registered config keys.

AdministrableConfig::setConfig(array $config); // sets config values for any registered config key in $config array, running validation rules
AdministrableConfig::getConfig(); // returns values for all registered config keys
AdministrableConfig::getPublicConfig(); // returns values for config keys registered with public: true

These methods are utilised by web API of this package.

Config Repository Extension & Config Rewriter

This package extends basic config Facade of Laravel Framework wrapping it in EscolaLms\Settings\ConfigRewriter\ConfigRepositoryExtension decorator. This extended Config repository has a write method that can be called to store all in-memory changes to configuration values straight into config files. Writing operation tries to preserve structure of original config files (order of keys, comments, etc.) but it's not always possible (parses this package uses is WIP) and sometimes everything other than keys and values can be removed from config file. Using Database to store modified config values is a safer (non-destructive) option.

Endpoints

All the endpoints are defined in swagger.

Events

  • EscolaLms\Settings\Events\SettingPackageConfigUpdated emitted when settings are changed using web API.

Listeners

No Listeners are defined in this package.

How to use this package on Frontend

Admin Panel

Left menu

Admin panel menu

List of registered Settings for single package (EscolaLms\Auth package used in screenshot)

List of registered settings for single package

Editing registered Setting

Editing registered Setting

Tests

Run ./vendor/bin/phpunit --filter 'EscolaLms\\Settings\\Tests' to run tests. See tests folder as it's quite good staring point as documentation appendix.

Test details: codecov phpunit

Permissions

Permissions are defined in Enum and seeded in Seeder.

Roadmap. Todo. Troubleshooting

  • Describe what "Settings" part of this package does (as only "Config" was described, and this package has/had second purpose)

escolalms/settings 适用场景与选型建议

escolalms/settings 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 206.73k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 09 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 escolalms/settings 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 206.73k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 30
  • 推荐数: 6

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-02