PHPackages                             serendipity-swow/serendipity-job - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. serendipity-swow/serendipity-job

ActiveLibrary[Queues &amp; Workers](/categories/queues)

serendipity-swow/serendipity-job
================================

v2.0.x-dev(3y ago)4405MITPHPPHP &gt;=8.0

Since Jun 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/SerendipitySwow/Serendipity-job)[ Packagist](https://packagist.org/packages/serendipity-swow/serendipity-job)[ RSS](/packages/serendipity-swow-serendipity-job/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (40)Versions (2)Used By (0)

*Serendipity-Job*
=================

[](#serendipity-job)

🚀 🏆 Task Platform Developed Based On Swow and Php8

[![PHP Version](https://camo.githubusercontent.com/7d770db38bc264d6f6edd39b48046edd50fedd1d436e52f3cd6e79a80da4c44d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d382e302d79656c6c6f773f7374796c653d666c6174266c6f676f3d706870)](https://github.com/MarwanAlsoltany/blend/search?l=php)[![Latest Version on Packagist](https://camo.githubusercontent.com/b37c261eac3f4b5aa1ccd9570f046669cc532366e0dd64c56011b7a30ab08094/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73776f772d636c6f75642f6a6f622e7376673f7374796c653d666c6174266c6f676f3d7061636b6167697374)](https://packagist.org/packages/serendipity-swow/serendipity-job)[![Total Downloads](https://camo.githubusercontent.com/cb7ff3eee5da36f52762c7ac190d98467c176a27fc23a48bf461061bca36dce5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736572656e6469706974792d73776f772f736572656e6469706974792d6a6f622e7376673f7374796c653d666c6174266c6f676f3d7061636b6167697374)](https://packagist.org/packages/serendipity-swow/serendipity-job/stats)[![License](https://camo.githubusercontent.com/8e5bdeb25cec99ef8c5345207c75dcab39dc539399bd321e9f4e73396b581686/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d7265642e7376673f7374796c653d666c6174266c6f676f3d676974687562)](./LICENSE)

[![Open in Visual Studio Code](https://camo.githubusercontent.com/e1bdc73074d82f0adbaa34cdbaed2d5fe414dbcecf64dfe1a6d748f11f630c61/68747470733a2f2f6f70656e2e7673636f64652e6465762f6261646765732f6f70656e2d696e2d7673636f64652e737667)](https://open.vscode.dev/MarwanAlsoltany/blend)[![Star](https://camo.githubusercontent.com/9d5977742bc1f4a2737dd207f1673b289ab667534c7451da5c51f4a9f0e21df5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f536572656e64697069747953776f772f536572656e6469706974792d6a6f622e7376673f7374796c653d736f6369616c266c6162656c3d53746172)](https://GitHub.com/serendipity-swow/serendipity-job/stargazers)

[![](/img/logo.png)](https://github.com/SerendipitySwow/Serendipity-job)

 [ ![](https://camo.githubusercontent.com/71a7afb3d260ffff9f8033830b390fc032c01d80688652fd7dcf75f8c94ddfde/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f6c2f626c69747a2e7376673f7374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d30303030303026636f6c6f723d626c7565) ](https://github.com/SerendipitySwow/Serendipity-job/blob/main/LICENSE)

[![home](./img/monitor-dashboard.jpg)](./img/monitor-dashboard.jpg)[![home](./img/info.jpg)](./img/info.jpg)[![home](./img/stat.png)](./img/stat.png)[![home](./img/debug.png)](./img/debug.png)[![home](./img/exception.png)](./img/exception.png)

🚀Serendipity-Job For 🏆Swow 分布式任务平台
==================================

[](#serendipity-job--for-swow-分布式任务平台)

🚀 🏆 Task Platform Developed Based On Swow and Php8

介绍
--

[](#介绍)

如今通过PHP开发的任务平台还是停留在原来地同步阻塞模式,通过结合swow开启PHP高性能时代,正式拥抱协程。消息队列选择Nsq利用其易部署,高性能，支持分布式特性。通过Redis分布式锁防止任务并行，实现watchdog防止任务还在执行，而redis锁被释放。给锁续期。该任务平台支持API投递,可以限制其执行时间，支持任务编排,用户可以实时查看任务详情和取消任务,后台支持丰富的图表包括任务统计(成功,失败...)

👇 Features👇
-----------

[](#-features)

```
1.支持Api投递任务.推送Nsq进行消费.(完成)
2.支持任务单个运行，并限制在时间内.超出限制时间抛异常(完成)
3.支持任务编排,单个任务限制时间.(完成)
4.支持任务编排支持事务.(暂不考虑)
5.支持重试机制,中间件(完成)
6.支持API查看任务消息
7.支持后台配置任务.
8.支持定时任务Crontab.(完成,考虑是否取消定时任务)
9.支持任务图表(成功,失败,重试,超时,终止.)(开发中)
10.支持任务取消(完成)
11.签名验证(完成)
12.支持刷新应用签名(完成)
13.支持系统监控基于xhprof(不支持sql)不建议开启
14.workflow->https://github.com/uuf6429/state-engine-php
15.支持分布式(Task可以支持分布式)(完成)
16.支持分布式锁(watchdog实现给锁续期)
17.任务执行超时时kill掉，资源回收(完成)
18.支持debug和trace查看(https://github.com/chevere/xr)
19.watchdog限制其最大执行时间 默认60s
20.美化了Swow提供的Debugger组件。
21.新增Debugger:m->获取当前使用内存,server->获取当前服务server信息包括Host,Port,连接数

```

基于Vue、Vditor，所构建的在线 Markdown 编辑器，支持流程图、甘特图、时序图、任务列表、HTML 自动转换为 Markdown 等功能；🎉新增「所见即所得」编辑模式。
-------------------------------------------------------------------------------------------

[](#基于vuevditor所构建的在线-markdown-编辑器支持流程图甘特图时序图任务列表html-自动转换为-markdown-等功能新增所见即所得编辑模式)

[地址](https://github.com/nicejade/markdown-online-editor)

👇 Please note👇
--------------

[](#-please-note)

```
1.传递的任务Task必须实现JobInterface
2.不能包含资源对象.
3.Swow/channel push 和pop 都是毫秒.任务都可以支持毫秒.以后必须要注意.
4.Di主要使用Hyperf/Di
5.取消任务使用kill
6.crontab随消费进程一起启动
7.限制任务执行时间通过channel 限制pop时间如果pop超时直接对执行任务的协程抛出异常.$coroutine->throw($exception);
[ERROR] Consumer failed to consume Consumer,reason: Channel wait producer failed, reason: Timed out for 5000 ms,file: /Users/heping/Serendipity-Job/src/Util/Waiter.php,line: 53
8.不建议同时启动dag和task两个消费。最好单独部署两个项目,server需要连接对应消费端启动的server查看任务详情或者取消任务.而且定时任务没有做集群处理。多台机器只能执行一个任务.
9.请尽量使用框架自带协程的创建方法,主要用日志上下文管理
 Hyperf\Utils\Coroutine::create()
10.任务执行时间尽量调大一点
11.dag(任务编排)的执行时间必须要小于nsq的max_msg_timeout的时间，因为超过了nsq会重新入队列

```

👇 接口文档👇
-------

[](#-接口文档)

见API.md

正在进行中的功能
--------

[](#正在进行中的功能)

- 环境
- 通过获取服务节点操作任务(分布式),在计划中
- 考虑优化项目结构
- 支持任务图表
- [后台](https://github.com/kanyxmo/MineAdmin)

TODO V3
-------

[](#todo-v3)

- 适配其他框架(需要优化项目架构后)
- codecov代码覆盖率
- 静下来想想思考项目的规划,架构
- 考虑使用swow-cloud/redis-subscriber订阅消息
- 支持后台创建任务
- [支持ORM](https://github.com/cycle/orm)
- [FORM](https://github.com/BoBoooooo/Element-Pro-Crud)

Come on!
--------

[](#come-on)

Thanks Hyperf.Swow!
-------------------

[](#thanks-hyperfswow)

Required
--------

[](#required)

```
1.PHP8
2.Nsq
3.redis
4.mysql
5.ext-swow
6.consul
7.ext-simdjson(https://github.com/crazyxman/simdjson_php)

```

👇 Usage👇
--------

[](#-usage)

[使用说明](usage.md)

👇 任务编排👇
-------

[](#-任务编排)

[使用说明](dag.md)

安装
--

[](#安装)

```
composer require swow-cloud/job -vvv
```

配置文件
----

[](#配置文件)

需要把`config.php` `container.php` `providers.yaml` 和`autoload`目录下的文件复制到项目`config`目录中

使用blend快速启动server
-----------------

[](#使用blend快速启动server)

1. 启动server

```
vendor/bin/blend server:start
```

2. 停止server

```
vendor/bin/blend server:stop
```

3. 重新启动

```
vendor/bin/blend server:restart
```

环境启动
----

[](#环境启动)

1.启动Serendipity-Job Server.

```
vendor/bin/job swow-cloud-job:start
```

2.启动Job 进行任务消费

```
vendor/bin/job job:start --host=127.0.0.1 --port=9764
```

#### 参数详解

[](#参数详解)

1.host server host监听地址,用于取消任务或者查看任务详情

2.port server port监听端口号

3.配置Crontab

```
 (new SwowCloud\Job\Crontab\Crontab())->setName('Foo')->setRule('*/5 * * * *')->setCallback([EchoCrontab::class, 'execute'])->setMemo('这是一个示例的定时任务'),
```

### Supporters

[](#supporters)

[![JET BRAINS](img/jetbrains.png)](https://www.jetbrains.com/?from=SerendipitySwow/Serendipity-job)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

1427d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/06a39414bf0d4d636aa8580cdc2baf90b35af54ca7f2b8ad69f350971f8089a4?d=identicon)[b200806](/maintainers/b200806)

---

Top Contributors

[![AuroraYolo](https://avatars.githubusercontent.com/u/20986749?v=4)](https://github.com/AuroraYolo "AuroraYolo (453 commits)")

---

Tags

hyperfjobphp8swooleswowtasktask-schedulerdebugjobswoolecoroutinetaskphp8swownsq

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/serendipity-swow-serendipity-job/health.svg)

```
[![Health](https://phpackages.com/badges/serendipity-swow-serendipity-job/health.svg)](https://phpackages.com/packages/serendipity-swow-serendipity-job)
```

###  Alternatives

[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)

PHPackages © 2026

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