Skip to content

banyancheung/cron-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swoft 定时任务组件

swoft定时任务组件,核心大部分基于1.0,在此基础上适配了2.0,实测可用。

安装

  • composer command
composer require banyancheung/cron-task
  • composer.json
"require": {
    ...
    "banyancheung/cron-task": "dev-master",
    ...
}

然后 composer update 即可。

使用

1.在app/beans.php 文件里的server一项,监听 onPipeMessage 事件。

2.在定义好的task注解里,增加 Scheduled 一项。

注意:Scheduled里的task属性是必须的,用于定位是哪个Task,也许会有更好的方法。:)

3.应用配置里增加 cron 配置项

LICENSE

The Component is open-sourced software licensed under the Apache license.