PHPackages                             yzh52521/http-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. [HTTP &amp; Networking](/categories/http)
4. /
5. yzh52521/http-crontab

ActiveLibrary[HTTP &amp; Networking](/categories/http)

yzh52521/http-crontab
=====================

接口化秒级定时任务管理

v1.33(2y ago)103621[2 issues](https://github.com/yzh52521/http-crontab/issues)Apache-2.0PHPPHP &gt;=7.2.5

Since Jun 27Pushed 2y ago3 watchersCompare

[ Source](https://github.com/yzh52521/http-crontab)[ Packagist](https://packagist.org/packages/yzh52521/http-crontab)[ RSS](/packages/yzh52521-http-crontab/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (7)Versions (27)Used By (0)

接口化秒级定时任务
=========

[](#接口化秒级定时任务)

概述
--

[](#概述)

基于 **Workerman** + **ThinkPHP6.x/8.x** 的接口化秒级定时任务管理，兼容 Windows 和 Linux 系统。

定时器格式说明：
--------

[](#定时器格式说明)

```
0   1   2   3   4   5
|   |   |   |   |   |
|   |   |   |   |   +------ day of week (0 - 6) (Sunday=0)
|   |   |   |   +------ month (1 - 12)
|   |   |   +-------- day of month (1 - 31)
|   |   +---------- hour (0 - 23)
|   +------------ min (0 - 59)
+-------------- sec (0-59)[可省略，如果没有0位,则最小时间粒度是分钟]

```

任务分类
----

[](#任务分类)

- url 任务可以指定一个url地址来请求，没有什么可解释的。
- Class 任务必须指定带有 命名空间的类名，并且实现一个 public 属性的方法：execute 方法返回值为 bool/string类型，支持自定义方法 事例：target='app\\common\\model\\User@check' @后面是方法
- Command 任务请先按照 thinkphp 官方文档定义好执行命令，在新增任务，输入定义的 命令 即可 例如：version
- Shell 任务 在新增任务，输入定义的 shell命令 即可 例如：ps -ef | grep php

简单使用
----

[](#简单使用)

**启动服务**

[![](https://camo.githubusercontent.com/7e73b99f35c53ab7772f3f886485deeae3f509b8fd2ac40e8c5dbec428bb0f33/68747470733a2f2f7777772e776f726b65726d616e2e6e65742f75706c6f61642f696d672f32303232303632372f32373632623937353863346366382e6a7067)](https://camo.githubusercontent.com/7e73b99f35c53ab7772f3f886485deeae3f509b8fd2ac40e8c5dbec428bb0f33/68747470733a2f2f7777772e776f726b65726d616e2e6e65742f75706c6f61642f696d672f32303232303632372f32373632623937353863346366382e6a7067)

**效果图**[![](https://camo.githubusercontent.com/8e513379e7eadfe1ada8b893fe1b19431b335f036ce130b633e86bb343cb5839/68747470733a2f2f7777772e776f726b65726d616e2e6e65742f75706c6f61642f696d672f32303232303431322f31323632353530363336346532392e706e67)](https://camo.githubusercontent.com/8e513379e7eadfe1ada8b893fe1b19431b335f036ce130b633e86bb343cb5839/68747470733a2f2f7777772e776f726b65726d616e2e6e65742f75706c6f61642f696d672f32303232303431322f31323632353530363336346532392e706e67)[![](https://camo.githubusercontent.com/e12be28607eba52dae0e05d212ce3c78a972e2768fe666ee8eb0f478e9ebc4e3/68747470733a2f2f7777772e776f726b65726d616e2e6e65742f75706c6f61642f696d672f32303232303431322f31323632353530363839306131362e706e67)](https://camo.githubusercontent.com/e12be28607eba52dae0e05d212ce3c78a972e2768fe666ee8eb0f478e9ebc4e3/68747470733a2f2f7777772e776f726b65726d616e2e6e65742f75706c6f61642f696d672f32303232303431322f31323632353530363839306131362e706e67)

 定时器接口说明
=========

[](#-定时器接口说明-)

PING
----

[](#ping)

### 基本信息

[](#基本信息)

**Path：** /crontab/ping

**Method：** GET

**接口描述：**

```
{
     "code": 200,
     "data": "pong",
     "msg": "信息调用成功！"
}

```

### 请求参数

[](#请求参数)

### 返回数据

[](#返回数据)

   名称类型是否必须默认值备注其他信息   codenumber非必须 datastring非必须 msgstring非必须  修改
--

[](#修改)

### 基本信息

[](#基本信息-1)

**Path：** /crontab/modify

**Method：** POST

**接口描述：**

```
{
  "code": 200,
  "data": true,
  "msg": "信息调用成功！"
}
```

### 请求参数

[](#请求参数-1)

**Headers**

参数名称参数值是否必须示例备注Content-Typeapplication/x-www-form-urlencoded是**Body**

参数名称参数类型是否必须示例备注idtext是1fieldtext是status字段\[status; sort; remark; title,rule\]valuetext是1值列表
--

[](#列表)

### 基本信息

[](#基本信息-2)

**Path：** /crontab/index

**Method：** GET

**接口描述：**

```
{
  "code": 200,
  "data": {
    "total": 4,
    "data": [
      {
        "id": 1,
        "title": "输出 tp 版本",
        "type": 1,
        "rule": "*/3 * * * * *",
        "target": "version",
        "parameter": "",
        "running_times": 3,
        "last_running_time": 1625636646,
        "remark": "每3秒执行",
        "sort": 0,
        "status": 1,
        "singleton": 1,
        "create_time": 1625636609,
        "update_time": 1625636609
      },
        {
        "id": 2,
        "title": "class任务 每月1号清理所有日志",
        "type": 2,
        "rule": "0 0 1 * *",
        "target": "app\\common\\crontab\\ClearLogCrontab",
        "parameter": "",
        "running_times": 71,
        "last_running_time": 1651121710,
        "remark": "",
        "sort": 0,
        "status": 1,
        "create_time": 1651114277,
        "update_time": 1651114277,
        "singleton": 1
        },
    ],
  },
  "msg": "信息调用成功！"
}

```

### 请求参数

[](#请求参数-2)

**Query**

参数名称是否必须示例备注page是1页码limit是15每页条数filter否{"title":"输出 tp 版本"}检索字段值op否{"title":"%\*%"}检索字段操作删除
--

[](#删除)

### 基本信息

[](#基本信息-3)

**Path：** /crontab/delete

**Method：** POST

**接口描述：**

```
{
     "code": 200,
     "data": true,
     "msg": "信息调用成功！"
}
```

### 请求参数

[](#请求参数-3)

**Headers**

参数名称参数值是否必须示例备注Content-Typeapplication/x-www-form-urlencoded是**Body**

参数名称参数类型是否必须示例备注idtext是1,2定时器池
----

[](#定时器池)

### 基本信息

[](#基本信息-4)

**Path：** /crontab/pool

**Method：** GET

**接口描述：**

```
"code": 200,
"data": [
 {
   "id": 1,
   "type": 1,
   "target": "version",
   "rule": "*/3 * * * * *",
   "parameter": "",
   "remark": "每3秒执行",
   "singleton":1,
   "create_time": "2021-07-07 13:43:29"
 }
],
 "msg": "信息调用成功！"
}

```

### 请求参数

[](#请求参数-4)

日志
--

[](#日志)

### 基本信息

[](#基本信息-5)

**Path：** /crontab/flow

**Method：** GET

**接口描述：**

```
{
  "code": 200,
  "msg": "ok",
  "data": {
    "total": 97,
    "data": [
      {
        "id": 257,
        "crontab_id": 1,
        "target": "version",
        "parameter": "",
        "exception": "v6.0.12LTS",
        "return_code": 0,
        "running_time": "0.834571",
        "create_time": 1651123800,
        "update_time": 1651123800
      },
      {
        "id": 251,
        "crontab_id": 1,
        "target": "version",
        "parameter": "",
        "exception": "v6.0.12LTS",
        "return_code": 0,
        "running_time": "0.540384",
        "create_time": 1651121700,
        "update_time": 1651121700
      },
      {
        "id": 246,
        "crontab_id": 1,
        "target": "version",
        "parameter": "",
        "exception": "v6.0.12LTS",
        "return_code": 0,
        "running_time": "0.316019",
        "create_time": 1651121640,
        "update_time": 1651121640
      },
      {
        "id": 244,
        "crontab_id": 1,
        "target": "version",
        "parameter": "",
        "exception": "v6.0.12LTS",
        "return_code": 0,
        "running_time": "0.493848",
        "create_time": 1651121580,
        "update_time": 1651121580
      }
    ]
  }
}

```

### 请求参数

[](#请求参数-5)

**Query**

参数名称是否必须示例备注page是1页码limit是15每页条数filter否{"crontab\_id":"1"}检索字段值op否{"crontab\_id":"="}检索字段操作添加
--

[](#添加)

### 基本信息

[](#基本信息-6)

**Path：** /crontab/add

**Method：** POST

**接口描述：**

```
{
    "code": 200,
    "data": true,
    "msg": "信息调用成功！"
}

```

### 请求参数

[](#请求参数-6)

**Headers**

参数名称参数值是否必须示例备注Content-Typeapplication/x-www-form-urlencoded是**Body**

参数名称参数类型是否必须示例备注titletext是输出 thinkphp 版本任务标题typetext是1任务类型 (1 command, 2 class, 3 url,4 shell)ruletext是\*/3 \* \* \* \* \*任务执行表达式targettext是version调用任务字符串parametertext否调用任务参数(url和shell无效)remarktext是每3秒执行备注sorttext是0排序statustext是1状态\[0禁用; 1启用\]singletontext否1是否单次执行 \[0 是 1 不是\]重启
--

[](#重启)

### 基本信息

[](#基本信息-7)

**Path：** /crontab/reload

**Method：** POST

**接口描述：**

```
{
  "code": 200,
  "msg": "信息调用成功",
  "data": {
  }
}
```

### 请求参数

[](#请求参数-7)

**Headers**

参数名称参数值是否必须示例备注Content-Typeapplication/x-www-form-urlencoded是**Body**

参数名称参数类型是否必须示例备注idtext是1,2计划任务ID 多个逗号隔开### 返回数据

[](#返回数据-1)

```
{
  "code": 200,
  "msg": "信息调用成功",
  "data": {
  }
}
```

###  Health Score

27

—

LowBetter than 52% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

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 ~17 days

Recently: every ~35 days

Total

26

Last Release

933d ago

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

v1.25PHP &gt;=7.2.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/052aa4acd90ad5d672ae5abe8d27d1f576f9c07e1967e2f6bced03b84079310f?d=identicon)[yuanzhihai](/maintainers/yuanzhihai)

---

Top Contributors

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

---

Tags

httpcrontab

### Embed Badge

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

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

###  Alternatives

[middlewares/fast-route

Middleware to use FastRoute

96189.1k14](/packages/middlewares-fast-route)[cshaptx4869/http-crontab

接口化定时任务管理

112.1k](/packages/cshaptx4869-http-crontab)[mezzio/mezzio-fastroute

FastRoute integration for Mezzio

172.6M47](/packages/mezzio-mezzio-fastroute)[amphp/http-server-router

Routes to request handlers based on HTTP method and path for amphp/http-server.

39485.8k25](/packages/amphp-http-server-router)[mezzio/mezzio-tooling

Migration and development tooling for Mezzio

191.1M20](/packages/mezzio-mezzio-tooling)[hyperf/http-server

A HTTP Server for Hyperf.

102.8M259](/packages/hyperf-http-server)

PHPackages © 2026

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