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.
GeneralSettings, PaymentSettings), enabling modular configuration management without global state pollution..env files (fallback defaults) and legacy configurations via migration updates.Spatie\DataTransferObject).down() methods).lock()).settings_v1, settings_v2) for backward compatibility?Money, Duration)? If so, how will we register and test them?make:setting, make:settings-migration)..env, config files, hardcoded values) to identify candidate settings.app, features, third_party) and access patterns (e.g., read-heavy vs. write-heavy).make:setting and make:settings-migration to generate boilerplate..env with database-backed settings for dynamic values (e.g., APP_DEBUG, QUEUE_CONNECTION).MAX_RETRIES, TIMEOUT_SECONDS) to typed settings.config() with fallback defaults during transition..env or config files for settings.ext-json, ext-mbstring).composer require spatie/laravel-settings.php artisan vendor:publish --provider="Spatie\LaravelSettings\LaravelSettingsServiceProvider" --tag="migrations,config".settings.php (e.g., default_repository, cache).AppSettings).php artisan make:settings-migration InitialSettings.app.name, app.timezone).php artisan migrate.make:setting for new groups (e.g., php artisan make:setting FeatureFlags --group=features).features.new_user_notification).public function __construct(public AppSettings $settings) {}
'cache' => [
'enabled' => true,
'store' => 'redis',
'ttl' => 60, // 1 minute
]
Spatie\LaravelSettings\Events\SettingsUpdated).spatie/laravel-settings for breaking changes (e.g., PHP 8.1+ requirements).How can I help you explore Laravel packages today?