subham/filament-dynamic-settings
Composer 安装命令:
composer require subham/filament-dynamic-settings
包简介
Dynamic settings plugin for Filament
README 文档
README
A flexible Laravel package for managing dynamic settings in Filament admin panels with support for both single-tenant and multi-tenant applications.
Features
- Flexible Tenancy: Works with both single-tenant and multi-tenant applications
- Custom Components: Extensible system for custom field types
- Dynamic Field Resolution: Automatic component resolution based on field types
- Module Organization: Organize settings into logical modules
- Multiple Layouts: Support for tabs and section layouts
- Type Safety: Automatic type casting for different field types
Installation
composer require subham/filament-dynamic-settings php artisan filament-dynamic-settings install
Filament Compatibility
| Version | Filament Version |
|---|---|
main |
Filament v5 |
^2.x |
Filament v4 |
^1.x |
Filament v3 |
Ensure that you are using the correct version of this package that is compatible with your Filament installation
Setting Resource Image
Manage Setting Page Image (Tab/Section)
Configuration
Single Tenant Setup
// config/filament-dynamic-settings.php return [ 'multi_tenant' => false, // ... other config ];
Multi-Tenant Setup
// config/filament-dynamic-settings.php return [ 'multi_tenant' => true, 'tenant_model' => App\Models\Tenant::class, 'tenant_column' => 'tenant_id', // ... other config ];
Layout Configuration
This package allows you to customize the layout behavior of dynamic Filament forms.
You can control how tabs and sections are rendered using configuration options.
Tabs Layout
Configure how tabs are displayed in your forms.
'tabs_layout' => [ 'vertical_tab' => false, 'contained' => true, ],
| Option | Type | Default | Description |
|---|---|---|---|
| vertical_tab | bool | false | Display tabs in vertical orientation |
| contained | bool | true | Wrap tabs inside a container layout |
Sections Layout
This package allows you to control how form sections are rendered in Filament dynamic forms.
You can adjust layout behavior using the sections_layout configuration.
Configuration
'sections_layout' => [ 'aside' => false, 'collapsible' => false, ],
| Option | Type | Default | Description |
|---|---|---|---|
| aside | bool | false | Displays the section in an aside (side column) layout |
| collapsible | bool | false | Enables collapsing/expanding of sections |
Usage
Basic Usage
use Subham\FilamentDynamicSettings\Facades\Settings; // Get a setting (cached, with type formatting) $value = Settings::get('app_name', 'general', 'Default App Name'); // Get a raw setting value (no cache, no formatting) $raw = Settings::raw('app_name', 'general', 'Default App Name'); // Set a setting value (updates existing, invalidates cache) Settings::set('app_name', 'My Application', 'general'); // Get all settings for a module $allGeneral = Settings::module('general'); // In multi-tenant mode (tenant ID is auto-detected) $value = Settings::get('app_name', 'general', 'Default App Name'); // Explicitly specify tenant $value = Settings::get('app_name', 'general', 'Default App Name', $tenantId);
Blade Directives for Filament Dynamic Settings
@setting('key_name','module_name','default_value','tenant');
@rawsetting('key_name','module_name','default_value','tenant');
<!-- Display site title with escaping -->
<h1>@setting('site_title', 'general', 'My Website')</h1>
<!-- Display HTML content without escaping -->
<div class="footer">
@rawsetting('footer_html', 'content', '<p>Default footer</p>')
</div>
<!-- Multi-tenant usage -->
<meta name="description" content="@setting('meta_description', 'seo', 'Default description', 'tenant_id')">
Use @setting for user-generated content. Only use @rawsetting when you need to output trusted HTML content.
Creating Custom Components
1. Register in Config
// config/filament-dynamic-settings.php 'custom_components' => [ 'color_picker' => [ 'component' => YourCustomComponent::class, 'label' => 'Label for your component', 'description' => 'Description..', ], ],
Advanced Multi-Tenant Usage
Custom Tenant Resolution
If you need custom tenant resolution logic, you can extend the Setting model:
namespace App\Models; use Subham\FilamentDynamicSettings\Models\Setting as BaseSetting; class Setting extends BaseSetting { protected static function getCurrentTenantId() { if (auth()->check() && auth()->user()->currentTeam) { return auth()->user()->currentTeam->id; } return parent::getCurrentTenantId(); } }
License
This package is open-sourced software licensed under the MIT license.
Changelog
See the changelog for details on changes made in each version.
Contributing
Contributions are welcome! Please create a pull request or open an issue if you find any bugs or have feature requests.
Support
If you find this package useful, please consider starring the repository on GitHub to show your support.
subham/filament-dynamic-settings 适用场景与选型建议
subham/filament-dynamic-settings 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.66k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2025 年 08 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 subham/filament-dynamic-settings 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 subham/filament-dynamic-settings 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-30

