PHPackages                             watsonhaw/think-cron - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. watsonhaw/think-cron

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

watsonhaw/think-cron
====================

think cron task extend for thinkphp8

v1.1.0(today)00[1 PRs](https://github.com/watsonhaw5566/think-cron/pulls)Apache-2.0PHPCI passing

Since Jun 26Pushed todayCompare

[ Source](https://github.com/watsonhaw5566/think-cron)[ Packagist](https://packagist.org/packages/watsonhaw/think-cron)[ RSS](/packages/watsonhaw-think-cron/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (8)Versions (4)Used By (0)

think-cron 计划任务
===============

[](#think-cron-计划任务)

适用于 ThinkPHP 8 的计划任务（定时任务）扩展，支持丰富的周期表达、单服务器执行、防重叠执行、事件系统以及 think-swoole 集成。

安装方法
----

[](#安装方法)

```
composer require watsonhaw/think-cron

```

安装完成后会自动注册三个命令：`cron:run`、`cron:schedule` 与 `cron:show`。

使用方法
----

[](#使用方法)

### 创建任务类

[](#创建任务类)

继承 `watsonhaw\cron\Task`，在 `configure()` 中设置执行周期，在 `execute()` 中实现业务逻辑：

```
