dalholm / laravel-settings
Database settings package for Laravel
v0.5
2024-04-17 11:26 UTC
Requires
- php: ^8.3
- illuminate/console: ^11.0
- illuminate/container: ^11.0
- illuminate/http: ^11.0
- illuminate/support: ^11.0
Requires (Dev)
- laravel/framework: ^11.0
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^11.0
README
Simple and powerful settings package for laravel with fallback and cache option.
Installation
You can install the package via composer:
composer require dalholm/laravel-settings
Publish
php artisan vendor:publish --tag=laravel-settings
Config
/* * You can place your custom package configuration in here. */ return [ /* |-------------------------------------------------------------------------- | Cache |-------------------------------------------------------------------------- | Cache is only working with redis and uses cache tags | */ 'cache' => [ 'enabled' => env('SETTINGS_CACHE_ENABLED', false), 'profile' => Dalholm\LaravelSettings\Cache\CacheProfile::class, 'store' => null, ], /* |-------------------------------------------------------------------------- | Database settings |-------------------------------------------------------------------------- | You could use what ever you want | */ 'database' => [ 'connection' => null, 'table' => 'settings', 'key' => 'key', 'value' => 'value', ], /* |-------------------------------------------------------------------------- | Fallback |-------------------------------------------------------------------------- | Use this as a fallback if settings is not yet available in database | | Example: | "power" => "is-on" | */ 'fallback' => [ // ], ];
Usage
// Create / update setting or settings // Settings will automatically update database and replace cache settings(['key' => 'value']); // Create / update multple settings([ 'key 1' => 'value 1', 'key 2' => 'value 2', 'key 3' => 'value 3', // etc ]); // Get settings('key');
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email mikael@dalholm.se instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.