skylence/filament-system-configuration 问题修复 & 功能扩展

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

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

skylence/filament-system-configuration

最新稳定版本:v1.3.0

Composer 安装命令:

composer require skylence/filament-system-configuration

包简介

A flexible system configuration management plugin for Filament 5 with sidebar navigation.

README 文档

README

run-tests

A flexible system configuration management plugin for Filament 4 with sidebar navigation.

Requirements

Installation

composer require skylence/filament-system-configuration

Publish the config file:

php artisan vendor:publish --tag="filament-system-configuration-config"

Run migrations:

php artisan migrate

Basic Usage

1. Register the Plugin

Add the plugin to your Filament panel provider:

use Skylence\FilamentSystemConfiguration\FilamentSystemConfigurationPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentSystemConfigurationPlugin::make()
                ->sections([
                    \App\Config\Sections\GeneralSection::class,
                    \App\Config\Sections\SalesSection::class,
                ])
                ->sidebarGroups([
                    'General' => ['general'],
                    'Sales' => ['sales', 'tax'],
                ]),
        ]);
}

2. Create Configuration Sections

Create a section class that returns a ConfigSection:

<?php

namespace App\Config\Sections;

use Skylence\FilamentSystemConfiguration\Config\ConfigField;
use Skylence\FilamentSystemConfiguration\Config\ConfigGroup;
use Skylence\FilamentSystemConfiguration\Config\ConfigSection;

class GeneralSection
{
    public static function make(): ConfigSection
    {
        return ConfigSection::make('general')
            ->label('General')
            ->icon('heroicon-o-cog-6-tooth')
            ->sort(10)
            ->groups([
                ConfigGroup::make('store_information')
                    ->label('Store Information')
                    ->icon('heroicon-o-building-storefront')
                    ->description('Basic information about your store')
                    ->fields([
                        ConfigField::make('store_name')
                            ->label('Store Name')
                            ->text()
                            ->required()
                            ->placeholder('Enter your store name')
                            ->helperText('This name will be displayed in emails.')
                            ->sort(10),

                        ConfigField::make('store_email')
                            ->label('Store Email')
                            ->email()
                            ->required()
                            ->sort(20),

                        ConfigField::make('enable_notifications')
                            ->label('Enable Notifications')
                            ->toggle()
                            ->default(true)
                            ->usedInCode()
                            ->sort(30),
                    ]),
            ]);
    }
}

3. Access Configuration Values

Use the ConfigService to retrieve values:

use Skylence\FilamentSystemConfiguration\Services\ConfigService;

// In a service or controller
$configService = app(ConfigService::class);

// Get a single value with a default fallback
$storeName = $configService->get('general/store_information/store_name', 'My Store');

// Get multiple values
$settings = $configService->getMany([
    'general/store_information/store_name',
    'general/store_information/store_email',
]);

// Set a value
$configService->set('general/store_information/store_name', 'New Store Name');
$configService->clearCache();

// Set multiple values
$configService->setMany([
    'general/store_information/store_name' => 'New Store',
    'general/store_information/store_email' => 'new@example.com',
]);

Configuration

Permissions

By default, the plugin uses two permissions:

  • view_system_configuration - to view the configuration page
  • update_system_configuration - to save configuration changes

Disable permission checking by setting to false:

// config/filament-system-configuration.php
'permissions' => [
    'view' => false,
    'update' => false,
],

Sidebar Groups

Define how sections appear in the sidebar:

'sidebar' => [
    'title' => 'Configuration',
    'description' => 'System Settings',
    'groups' => [
        'General' => ['general', 'design', 'currency'],
        'Sales' => ['sales', 'tax', 'shipping'],
        'Advanced' => ['features', 'system'],
    ],
],

Default Values

Set default values for configuration paths:

'defaults' => [
    'general/store_information/store_name' => 'My Store',
    'general/locale_options/currency' => 'USD',
],

Field Types

The plugin supports these field types:

Type Method Description
Text ->text() Single line text input
Textarea ->textarea() Multi-line text input
Select ->select($options) Dropdown selection
MultiSelect ->multiSelect($options) Multiple selection
Toggle ->toggle() Boolean toggle switch
Number ->number() Numeric input
Email ->email() Email input with validation
Password ->password() Password input (encrypted)
Color ->color() Color picker
ColorPalette ->colorPalette($options) Color selection from palette
Image ->image() Image upload
RichEditor ->richEditor() WYSIWYG editor
Info ->info() Read-only display field

Field Options

ConfigField::make('example')
    ->label('Example Field')
    ->text()
    ->required()
    ->default('default value')
    ->placeholder('Enter value...')
    ->helperText('Help text shown below field')
    ->rules(['min:3', 'max:100'])
    ->encrypted()                    // Encrypt value in database
    ->systemValueOption(false)       // Disable "Use system value" checkbox
    ->usedInCode()                   // Show "Used in code" indicator
    ->visible(fn () => true)         // Conditional visibility
    ->sort(10);                      // Display order

Events

The plugin dispatches events you can listen to:

// Listen for configuration changes
Event::listen('config.saved', function ($path, $value) {
    // Handle configuration change
});

Testing

composer test

License

MIT License

skylence/filament-system-configuration 适用场景与选型建议

skylence/filament-system-configuration 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.3k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 skylence/filament-system-configuration 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 4.3k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 20
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-12