Skip to content

Laravel 设置持久化工具包 / A persistent settings package for Laravel 6+

License

Notifications You must be signed in to change notification settings

xtrees/LaraSetting

Repository files navigation

LaraSetting (未完成后台)

Latest Version on Packagist Software License Total Downloads

Laravel 设置持久化工具包 / A persistent settings package for Laravel 6.0+

后台管理 / Setting manage interface

avatar


  • 数据库存储 / 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.

About

Laravel 设置持久化工具包 / A persistent settings package for Laravel 6+

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published