overnaive/think-swoole-crontab
Composer 安装命令:
composer require overnaive/think-swoole-crontab
包简介
A crontab component base on think-swoole.
README 文档
README
A crontab component base on think-swoole.
声明
核心逻辑来自于 Hyperf 的 hyperf/crontab 组件。非常感谢 Hyperf 为大家提供这么优的组件。
本组件试图让其运行在 ThinkPHP 里(需结合 think-swoole 组件)。
目前还处于初步可用阶段,后续会慢慢完善。
Requirement
- PHP >= 7.1
- Composer
Installation
composer require overnaive/think-swoole-crontab
Documents
Usage
- 在
event.php里为swoole.init事件添加监听类。
return [
...
'listem' => [
...
'swoole.init' => [
...
\ThinkSwooleCrontab\Process\CrontabDispatcherProcess::class,
...
],
...
],
...
];
- 在配置文件
crontab.php里添加\ThinkSwooleCrontab\Crontab实例。
return [
'crontab' => [
(new \ThinkSwooleCrontab\Crontab())->setName('test-1')
->setRule('* * * * * *')
->setCallback([Test::class, 'run'])
->setMemo('just a test crontab'),
(new \ThinkSwooleCrontab\Crontab())->setName('test-2')
->setRule('* * * * * *')
->setCallback([Test::class, 'run'])
->setMemo('just another test crontab'),
],
];
License
MIT
统计信息
- 总下载量: 42
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-17