swift-settings maintained by laravel-daddy
Description
easy way to manage and cache settings in laravel app
Author
Last update
2024/10/08 09:15
(dev-main)
License
Downloads
7
Swift Settings Package
Crafted with ♥️ by Laravel Daddy
Installation
To install the package, run the following command:
composer require laravel-daddy/swift-settings
Upon installation, the package will automatically publish the necessary migrations and register the SwiftSettingsServiceProvider.
Usage
All settings are automatically cached to enhance the performance of your application. This ensures that accessing settings is efficient and optimized.
You can manage settings using either the facade or the helper method.
Using the Facade
use LaravelDaddy\SwiftSettings\Facade\SwiftSettingsFacade;
// Retrieve a setting by its key, with a default value if the key doesn't exist
SwiftSettingsFacade::getSetting('key', 'default_value');
// Set a new value for a specific key
SwiftSettingsFacade::setSetting('key', 'value');
Using the Helper Method
// Retrieve a setting by its key, with a default value if the key doesn't exist
swift_settings()->getSetting('key', 'default_value');
// Set a new value for a specific key
swift_settings()->setSetting('key', 'value');
Both approaches allow you to retrieve or update settings efficiently, with all keys being cached for improved performance.