subham / filament-dynamic-settings
Dynamic settings plugin for Filament
Package info
github.com/subhamsharmaa/filament-dynamic-settings
pkg:composer/subham/filament-dynamic-settings
Requires
- php: >=8.2
- filament/filament: ^5.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpunit/phpunit: ^10.0|^11.0
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.

