wilbur-yu / hyperf-options
Global key-value store in the database
Installs: 2 220
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.4
- hyperf/cache: ^3.0
- hyperf/database: ^3.0
- hyperf/db-connection: ^3.0
- hyperf/di: ^3.0
- hyperf/event: ^3.0
- hyperf/http-server: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0.0
- mockery/mockery: ^1.0
- phpunit/phpunit: >=7.0
- swoole/ide-helper: ^5.0
- swow/swow: dev-develop
- symfony/var-dumper: ^5.1
README
该组件移植于 appstract/laravel-options, 感谢 作者 的开源作品
安装
composer require wilbur-yu/hyperf-options
php ./bin/hyperf.php vendor:publish wilbur-yu/hyperf-options
php ./bin/hyperf.php migarte
说明
<?php use WilburYu\HyperfOptions\OptionService; // 使用全局函数 options()->set('key', 'value', 'desc'); // 创建或更新 options()->get('key'); options()->exists('key'); options()->remove('key'); // 使用服务类 $options = make(OptionService::class); $options->set('key', 'value', 'desc'); $options->get('key'); $options->exists('key'); $options->remove('key');
得益于 hyperf
完善的组件生态, 监听 Option
模型的 Deleted 和 Saved
事件, 搭配 Cache 注解
,
可以很容易的完成 option 键值对
的缓存生命周期的维护.