jason-xt / lara-setting
A persistent settings package for Laravel 6.0+ with manager api and interface
Installs: 165
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
Language:Blade
Requires
- php: ~7.2
- laravel/framework: ~6.0
README
Laravel 设置持久化工具包 / A persistent settings package for Laravel 6.0+
后台管理 / Setting manage interface
- 数据库存储 / Database persistent
- Laravel 框架自带缓存 / Cache by Laravel framework
- 运行时缓存 / Runtime cache (Get from cache or db one time during Request Lifecycle)
Install
Via Composer
$ composer require xtrees/lara-setting $ php artisan vendor:publish --tag=config $ php artisan vendor:publish --tag=migrations $ php artisan migrate
Config
return [ //Use framework's cache drive 'cache' => [ 'mode' => 'batch', 'enable' => true, 'prefix' => 'settings:', //cache time .minutes 'ttl' => 60, ], //Facade name LaraSetting::get(..) 'facade' => 'LaraSetting', ];
Usage
//Helper funtion settings('group.key') //Create or update setting in DB/cache/runtime LaraSetting::set('group.key', 'setting-value'); //Get the setting from runtime/cache/DB LaraSetting::get('group.key'); //Remove setting LaraSetting::forget('group.key');
License
The MIT License (MIT). Please see License File for more information.