spatie/laravel-settings
Store strongly typed app settings in Laravel using dedicated Settings classes backed by databases, Redis, and more. Inject settings via the container, read and update properties, then save—keeping configuration structured, testable, and easy to manage.
.env variables, hardcoded values, or third-party config tools (e.g., AWS Parameter Store, Consul) with a type-safe, structured settings system. Ideal for SaaS platforms, multi-tenant apps, or complex feature flags.config('feature.x') checks with strongly typed FeatureFlags::enable_payments (with migrations for rollback safety).AppSettings::api_timeout) without .env duplication.php artisan make:setting PaymentSettings + SettingsController scaffold).TenantSettings::max_upload_size).PricingSettings::discount_threshold).ExperimentSettings::variant_a_rate).GDPRSettings::cookie_consent_required) with migration history.config() + .env).Settings class.laravel-config or vlucas/phpdotenv).spatie/laravel-activitylog for change tracking).spatie/laravel-medialibrary for unstructured configs (e.g., JSON blobs).spatie/laravel-query-builder for dynamic settings queries.EmailSettings::smtp_port must be 25|465|587).old_key to new_key)."This package lets us treat app settings like code—strongly typed, version-controlled, and auditable. Instead of hunting through .env files or hardcoded values, we’ll manage everything (e.g., feature flags, API timeouts, tenant limits) in a single, searchable database table. It cuts dev time by 30% for config changes and adds safety nets: migrations prevent broken deployments when we rename settings, and caching speeds up reads. For example, we can roll out a new payment processing rule to 10% of users by updating ExperimentSettings::audience_percentage—no more manual .env swaps."
ROI:
AuthSettings, BillingSettings) without spaghetti code.*"This replaces ad-hoc config solutions with a batteries-included system:
config('feature.x') typos—use app(FeatureFlags::class)->new_user_flow with autocompletion.old_key → new_key) without data loss.SETTINGS_CACHE_ENABLED=true for 100ms faster reads.Spatie\DataTransferObject).Migration Path:
php artisan make:setting AppSettings for global configs.php artisan make:settings-migration to backfill defaults.config('app.timezone') with app(AppSettings::class)->timezone.FeatureFlags::class and inject it into controllers.Trade-offs:
.env files.spatie/laravel-permission for admin panels)."*How can I help you explore Laravel packages today?