akaunting/laravel-setting
Persistent settings for Laravel with database and/or JSON drivers. Includes helper, facade, and Blade directive, supports encryption, caching, auto-save, extra columns, and custom tables/files. Can override Laravel config values for production-friendly tweaks.
config/, env, or .env sprawl.SettingUpdated), aligning with Laravel’s reactive patterns.settings) with key-value pairs, supporting serialized data (JSON, arrays) and scoped access (e.g., tenant_id).Setting::set('app.theme', 'dark');
$theme = Setting::get('app.theme');
Setting::cache()) to reduce DB load for read-heavy workloads.FormRequest or custom logic.| Risk Area | Mitigation Strategy |
|---|---|
| Schema Conflicts | Risk if settings table already exists. Mitigate via migration rollback or schema checks. |
| Performance | High-frequency writes to settings table could bottleneck. Mitigate with caching or batch updates. |
| Data Corruption | Serialized data (e.g., JSON) may break if schema changes. Use strict typing or migrations. |
| Concurrency | Race conditions on setting updates. Use database transactions or optimistic locking. |
| Legacy Systems | If settings were previously hardcoded/env-based, migration scripts may be needed to backfill data. |
tenant_id + user_id)?Setting facade can be swapped with a mock service provider.cache()->tags(['settings'])->flush()).php artisan vendor:publish --provider="Akaunting\Setting\SettingServiceProvider"
php artisan migrate
settings table if needed (e.g., add tenant_id column).config/, .env, or other sources into the settings table.Setting::set('app.debug', env('APP_DEBUG', false));
Setting::get() calls.config('app.use_new_settings')) to toggle old/new systems.Setting::cache(). Falls back to DB if unavailable.app.* settings).SettingUpdated event)..env).settings table may break the package..env/config to DB requires upfront effort.php artisan cache:clear) if settings aren’t updating.'App.Debug' ≠ 'app.debug').Setting::get() with cache() or invalidate manually.Setting::batch()) to reduce DB load.settings table is replicated in read-heavy setups.settings table lock contention under concurrent writes.| Scenario | Impact | Mitigation |
|---|---|---|
| DB Down | Settings unavailable. | Use fallback defaults or local cache. |
| Cache Stale | Users see outdated settings. | Implement cache invalidation on |
How can I help you explore Laravel packages today?