centrex/laravel-settings is a Laravel package for manage settings in laravel.
It currently has 0 GitHub stars and 3.280 downloads on Packagist (latest version v1.5.0).
Install it with composer require centrex/laravel-settings.
Discover more Laravel packages by centrex
or browse all Laravel packages to compare alternatives.
Last updated
Database-backed application settings with a caching layer, Laravel config integration, and convenient helper functions. Settings are stored in a settings table and cached forever until changed.
composer require centrex/laravel-settings
php artisan vendor:publish --tag="laravel-settings-migrations"
php artisan migrate
// Get a setting (with optional default)
settings('site.name', 'My App');
get_setting('site.name', 'My App');
// Set a setting
set_setting('site.name', 'Acme Corp');
// Check existence
setting_exists('site.name'); // true
// Remove a setting
remove_setting('site.name');
// Get the Settings service instance
$settingsService = settings();
use Centrex\Settings\Facades\Settings;
Settings::set('maintenance.enabled', true);
Settings::get('maintenance.enabled', false);
Settings::has('maintenance.enabled');
Settings::forget('maintenance.enabled');
// Force a cache refresh
Settings::refreshCache();
Settings are merged into the Laravel config on boot via chargeConfig(). After that, database settings are accessible through config():
config('site.name'); // returns the value stored in the settings table
Cache::rememberForever per key.set() or forget() call automatically flushes the cache and reloads config.composer test # full suite
composer test:unit # pest only
composer test:types # phpstan
composer lint # pint
Please see CHANGELOG for more information on what has changed recently.
The MIT License (MIT). Please see License File for more information.