PHPackages                             yzh52521/think-swoole-crontab - 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. yzh52521/think-swoole-crontab

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

yzh52521/think-swoole-crontab
=============================

crontab component think-swoole.

v1.0.7(2y ago)135MITPHPPHP &gt;=7.4

Since Jun 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/yuanzhihai/think-swoole-crontab)[ Packagist](https://packagist.org/packages/yzh52521/think-swoole-crontab)[ RSS](/packages/yzh52521-think-swoole-crontab/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (9)Used By (0)

think-swoole-crontab
====================

[](#think-swoole-crontab)

声明
--

[](#声明)

核心逻辑来自于 [Hyperf](https://hyperf.io) 的 [hyperf/crontab](https://github.com/hyperf/crontab) 组件。非常感谢 Hyperf 为大家提供这么优的组件。

本组件试图让其运行在 ThinkPHP 里（需结合 [think-swoole](https://github.com/top-think/think-swoole) 组件）。

目前还处于初步可用阶段，后续会慢慢完善。

Requirement
-----------

[](#requirement)

- PHP &gt;= 8.0
- [Composer](https://getcomposer.org/)

Installation
------------

[](#installation)

`composer require yzh52521/think-swoole-crontab`

Documents
---------

[](#documents)

- [swoole](https://wiki.swoole.com/#/)
- [hyperf/crontab](https://hyperf.wiki/2.0/#/zh-cn/crontab?id=%e5%ae%9a%e6%97%b6%e4%bb%bb%e5%8a%a1)

Usage
-----

[](#usage)

1. 在 `event.php` 里为 `swoole.init` 事件添加监听类。

```
return [
...
    'listen' => [
        ...
        'swoole.init' => [
            ...
            \ThinkCrontab\Process\CrontabDispatcherProcess::class,
            ...
        ],
        ...
    ],
...
];

```

2. 在配置文件 `crontab.php` 里添加 `\ThinkCrontab\Crontab` 实例。

```
return [
    'crontab' => [
        // Callback类型定时任务（默认）
        (new \ThinkCrontab\Crontab())->setName('test-1')
            ->setRule('* * * * * *')
            ->setCallback([app\Task\FooTask::class, 'execute'])
            ->setMemo('just a test crontab'),
        // Command类型定时任务
        (new \ThinkCrontab\Crontab())->setType('command')->setName('test-2')
            ->setRule('* * * * * *')
            ->setCallback([
            'command' => 'mailer:send',
            // (optional) arguments
            'arguments' => 'barValue'
            ]),
    ],
];

```

License
-------

[](#license)

MIT

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~13 days

Recently: every ~23 days

Total

8

Last Release

971d ago

PHP version history (2 changes)v1.0.0PHP &gt;=8.0

v1.0.6PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15060466?v=4)[听风吹雨](/maintainers/yuanzhihai)[@yuanzhihai](https://github.com/yuanzhihai)

---

Top Contributors

[![yuanzhihai](https://avatars.githubusercontent.com/u/15060466?v=4)](https://github.com/yuanzhihai "yuanzhihai (19 commits)")

### Embed Badge

![Health badge](/badges/yzh52521-think-swoole-crontab/health.svg)

```
[![Health](https://phpackages.com/badges/yzh52521-think-swoole-crontab/health.svg)](https://phpackages.com/packages/yzh52521-think-swoole-crontab)
```

###  Alternatives

[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[fisharebest/webtrees

webtrees online genealogy

73710.5k13](/packages/fisharebest-webtrees)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
