spatie/laravel-settings
Strongly typed application settings for Laravel. Define settings classes with typed properties, store values in a repository (database, Redis, etc.), inject settings via the container, and update them easily with $settings->save().
.env variables, hardcoded values, or third-party config services (e.g., AWS Parameter Store) with a type-safe, structured settings system tied to Laravel’s dependency injection. Enables teams to manage app-wide settings (e.g., feature flags, API keys, UI toggles) in a single, version-controlled location.new_payment_flow_enabled) without code deployments. Integrate with analytics to track adoption.tenant_branding_colors) in the same system, with repositories per tenant or shared defaults. Reduces boilerplate for tenant-aware logic.homepage_banner_text) based on user segments or A/B test variants, with settings updated via admin panels..env for non-sensitive, app-wide settings (e.g., MAX_UPLOAD_SIZE).Look Here If:
.env, static classes, or external services) that’s hard to audit or update.bool $dark_mode_enabled) to catch errors at compile time.FeatureFlags after launch).promo_banner_copy).prism).Look Elsewhere If:
*"This package lets us centralize and control app-wide settings—like feature toggles, UI themes, or API keys—without scattered .env files or manual database updates. It’s like Git for configuration: version-controlled, type-safe, and deployable via migrations. For example, we could:
null values for required APIs).
It’s a low-risk, high-reward upgrade that pays off in maintainability and speed."**"This replaces ad-hoc config management with a Laravel-native, migration-friendly system. Key wins:
isset($config['feature_flag']) hacks—settings are strongly typed (e.g., bool $dark_mode).php artisan make:setting FeatureFlags + Laravel Nova/Backpack integration).// Define once:
class AppSettings extends Settings {
public string $api_key;
public bool $maintenance_mode;
}
// Use anywhere:
$settings = app(AppSettings::class);
if ($settings->maintenance_mode) return view('maintenance');
Tradeoff: Adds a migration step for schema changes, but eliminates ‘works on my machine’ config issues."*
How can I help you explore Laravel packages today?