Laravel Settings Kit
Laravel Settings Kit is a package for managing settings in Laravel applications. Settings are defined in code, with their type and default value, and each user (or any other model) can have its own value.
Definitions in code
Types, defaults and who may override each setting are declared in the config file or with a fluent builder, and versioned with the app. There are no seeders, and every environment stays the same. The database only stores values that differ from the default.
Per-user or per-model values
With the HasSettings trait, each record of a model (users, teams, customers...) reads its own value first, then the global value, then the default. When you change a global value, it applies to everyone who hasn't overridden it.
Types and validation
It supports strings, booleans, integers, floats, arrays, option lists and PHP enums, plus any Laravel validation rule. Form or JSON input can be passed straight in: "1" becomes true and "42" becomes 42. Settings holding sensitive data, such as API keys, can be stored encrypted.
Settings screens
The panel() method returns what a preferences form needs: labels, descriptions, options, current and default values, and whether the user changed it. Texts are translated through Laravel's usual language files.
Queries and caching
All global values, or all of a user's values, are loaded with a single query, cached together and reused for the rest of the request. It works with any cache driver and with Octane.
Other tools
- Optional JSON endpoints, behind your own auth middleware and Gates
SettingUpdatedandSettingResetevents on every change@setting('key')Blade directive- Artisan commands to list, export, import and prune settings
Requirements
PHP 8.2 or higher and Laravel 11, 12 or 13.
Have an idea or want to collaborate?
Have an idea, want to team up on a project, or just want to talk tech? Drop us a line. We love meeting people who want to build things.
Let's talk