spatie/laravel-settings
Strongly typed app settings for Laravel stored in databases, Redis, and more. Define settings classes with typed properties, inject them via the container, and read/update values with simple save() calls. Includes migrations, caching, and multiple repositories.
.env variables or hardcoded values with a structured, type-safe settings system. Enables dynamic configuration without redeployments.feature_new_ui) in Settings classes for runtime toggling via admin panels.TenantSettings::class with repository() override).site_name, maintenance_mode) without code changes.old_api_key → api_key_v2).cache.enabled = true) to reduce database/Redis calls..env or Laravel’s config files).config + cache).spatie/laravel-config-array).app.themes.colors.primary; consider a key-value store like Redis with hashes)."This package lets us manage app-wide configurations (e.g., feature toggles, branding, API keys) in a structured, type-safe way—like a database for settings. Instead of hardcoding values or using .env files, we can:
"Problem: Managing app settings across .env, config files, and migrations is messy and error-prone.
Solution: spatie/laravel-settings gives us:
public bool $maintenance_mode), catching errors at compile time.old_key → new_key) alongside DB migrations.config('app.feature_flags') with FeatureFlags::class for better tooling and runtime updates."*"Why this over .env?
site_name in the admin panel without touching code.public string $api_key in the class; invalid inputs fail fast.php artisan make:setting and migrations with php artisan make:settings-migration.repository() to use Redis for high-traffic settings or custom logic.
Example workflow:MarketingSettings class with public int $max_discount.public function show(MarketingSettings $settings).$settings->max_discount = $request->input('max_discount'); $settings->save();."*How can I help you explore Laravel packages today?