Download the PHP package bambamboole/filament-settings without Composer
On this page you can find all versions of the php package bambamboole/filament-settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bambamboole/filament-settings
More information about bambamboole/filament-settings
Files in bambamboole/filament-settings
Package filament-settings
Short Description Manage application settings with a Filament UI
License MIT
Homepage https://github.com/bambamboole/filament-settings
Informations about the package filament-settings
Filament Settings
A database-driven settings plugin for Filament. Settings are organised into groups, edited through a tabbed Filament page, and read anywhere via the settings() helper or the typed SettingsRepository methods.
Installation
Publish and run the migration:
Setup
Register the plugin in your panel provider and pass your SettingGroup classes:
Generating a Setting Group
Use the Artisan command to scaffold a new SettingGroup class interactively:
The command asks for a class name, group key, and label, then writes the skeleton to app/Settings/{ClassName}.php:
The group key is derived automatically from the class name (GeneralSettings → general, MailNotificationSettings → mail-notification). Accept the defaults or type a custom value.
After generation, open the file and fill in schema() with Filament form components and optionally add casts(), icon(), and sort().
Defining a Setting Group
Create a class that extends SettingGroup. The key() is used as the DB prefix and the tab identifier; schema() returns standard Filament form components:
Field name convention
Form field names use snake_case (e.g. site_name). They are stored in the database as kebab-case keys prefixed with the group key (e.g. general.site-name).
Casts
Declare non-string fields in casts(). Supported types: boolean, integer. Everything else is returned as a raw string.
Access control per group
Override canAccess() on a group to hide it from certain users:
Reading Settings
Helper function
Typed repository methods
Injecting the repository
Caching
Caching is enabled by default. All settings for each tenant are loaded and cached in a single cache entry per tenant. Casts from all registered groups are cached together in one additional entry.
| Cache key | Contains |
|---|---|
settings.global |
All settings where team_id IS NULL |
settings.{id} |
All settings for tenant with that ID |
settings.casts |
Combined cast map from all SettingGroups |
The tenant bucket is automatically invalidated whenever a setting is saved or deleted. Configure the TTL or disable caching in config/filament-settings.php:
Multi-Tenancy
All settings have a team_id column. A global scope filters every query to the current tenant automatically. When team_id is null, the global (non-tenant) settings are used.
Configure the active tenant via the plugin:
When using Filament's built-in tenancy, Filament::getTenant() is used automatically — no manual configuration needed.
Plugin Options
| Method | Description |
|---|---|
groups(array) |
SettingGroup classes to register |
canAccess(Closure) |
Guard access to the entire settings page |
tenant(Closure) |
Custom resolver for the current tenant ID |
navigationSort(int) |
Position in the sidebar (default: 99) |
navigationGroup(?string) |
Sidebar group label (default: none) |
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Manuel Christlieb
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-settings with dependencies
filament/filament Version ^5.0
spatie/laravel-package-tools Version ^1.15.0