egough/laravel-settings
egough/laravel-settings provides a simple, flexible way to manage application settings in Laravel. Store key-value configuration in the database, read and update settings at runtime through a clean API, and benefit from built-in caching for fast access.
settings(), the Settings facade, or php artisan settings:set.billing.enabled) with a flag() helper and @hasFlag Blade directive let PMs gate a beta feature, price change, or billing panel to a subset of surfaces without coordinating a deploy. Caveat: these are global boolean flags, not percentage-based or per-segment rollouts.HasSettings trait gives any Eloquent model a scoped settings bag ($user->settings()->set('ui.theme', 'dark')), supporting personalization, onboarding state, notification preferences, and tenant branding without a new table per concern.string, int, float, bool, json), defaults, and cache invalidation so the UI work stays in the UI.SettingUpdated to trigger analytics or notifications when a toggle flips.config/ and .env; this is a useful forcing function for teams that have historically stuffed everything into config/ and redeployed to change a headline.Consider it when all of the following are true:
site.name is one key, not a nested path) and with model settings not inheriting global defaults (inheritance must be written explicitly).Look elsewhere when:
SettingCreated/Updated/Deleted events but ships no audit log; you would build that yourself by listening.To executives: This is a small, MIT-licensed Laravel package that lets us change application behavior — feature availability, site copy, limits, user preferences — from the database instead of shipping a release each time. That translates into faster experiments, cheaper rollouts, and fewer emergency deploys for operational toggles. It is low-cost to adopt but has a thin community footprint (few stars, no known dependents), so the responsible framing is: run a time-boxed pilot on one low-risk surface, wrap it behind an internal interface so we can swap or fork it, and vendor the code if we keep it. It should not hold secrets or boot-critical configuration.
To engineering: The API is conventional Laravel — helper, facade, injected SettingsManager, HasSettings trait for model scoping, @setting/@hasFlag Blade directives, settings:* Artisan commands, and SettingCreated/Updated/Deleted events that fire after commit. Caching is built in and invalidated on writes through the manager. Known constraints to design around: integer model IDs only, no global-to-model inheritance, literal dotted keys, 'false' string is truthy for flags (pass native booleans), and direct repository/SQL writes bypass cache invalidation and events. Recommended integration: adopt behind a thin internal Settings contract, pin the version, add tests for type round-trips, cache-after-write, event payloads, and owner isolation, and treat the package as vendored code we own rather than an upstream we depend on.
How can I help you explore Laravel packages today?