PHPackages                             dagasmart/task-schedule - 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. dagasmart/task-schedule

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

dagasmart/task-schedule
=======================

更灵活地管理应用中的任务调度

2.0.11(1y ago)1171MITPHPPHP &gt;=8.0

Since Apr 6Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/dagasmart/task-schedule)[ Packagist](https://packagist.org/packages/dagasmart/task-schedule)[ Docs](https://github.com/dagasmart/task-schedule)[ RSS](/packages/dagasmart-task-schedule/feed)WikiDiscussions main Synced 1mo ago

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

task-schedule任务调度
=================

[](#task-schedule任务调度)

> ⏱ 更灵活地管理 Laravel 应用中的任务调度。

功能
--

[](#功能)

- 通过 schedules 数据表来管理任务调度
- 支持开启关闭调度任务
- 支持通过数据表来更新任务执行间隔
- 支持 laravel 任务调度时的 timezone、environments、withoutOverlapping、onOneServer、runInBackground、evenInMaintenanceMode、Output（任务输出到文件、邮件）配置

Tips: 使用该扩展只是多了一种可以基于数据表维护任务调度的方式，不会破坏原先 Laravel 定义任务调度的方式，两种方式甚至可以组合使用。

安装和配置
-----

[](#安装和配置)

- 安装

```
$ composer require dagasmart/task-schedule
```

- 发布服务

```
$ php artisan vendor:publish --provider="DagaSmart\TaskSchedule\TaskScheduleServiceProvider"
```

- 执行迁移

```
php artisan migrate
```

使用
--

[](#使用)

为了能够更容易地集成到各种项目中，该扩展包并未直接提供一个 web 界面来维护 schedules 数据表，你可以按你的方式把 schedules 的配置维护进去就好。

举例说明项目中的使用方式：

- 维护应用程序中的 schedule 调度配置到 schedules 数据表

```
INSERT INTO `schedules` (`id`, `description`, `command`, `parameters`, `expression`, `active`, `timezone`, `environments`, `without_overlapping`, `on_one_server`, `in_background`, `in_maintenance_mode`, `output_file_path`, `output_append`, `output_email`, `output_email_on_failure`, `created_at`, `updated_at`) VALUES (1, '爬取 Github daily 趋势', 'github:trending', NULL, '*/10 * * * *', 1, 'Asia/Shanghai', NULL, 0, 0, 1, 1, 'github_trending.log', 1, NULL, 0, NULL, NULL);
INSERT INTO `schedules` (`id`, `description`, `command`, `parameters`, `expression`, `active`, `timezone`, `environments`, `without_overlapping`, `on_one_server`, `in_background`, `in_maintenance_mode`, `output_file_path`, `output_append`, `output_email`, `output_email_on_failure`, `created_at`, `updated_at`) VALUES (2, '爬取 Github weekly 趋势', 'github:trending', '--since=weekly', '59 23 * * *', 1, 'Asia/Shanghai', NULL, 0, 0, 1, 1, 'github_trending.log', 1, NULL, 0, NULL, NULL);
INSERT INTO `schedules` (`id`, `description`, `command`, `parameters`, `expression`, `active`, `timezone`, `environments`, `without_overlapping`, `on_one_server`, `in_background`, `in_maintenance_mode`, `output_file_path`, `output_append`, `output_email`, `output_email_on_failure`, `created_at`, `updated_at`) VALUES (3, '爬取 Github monthly 趋势', 'github:trending', '--since=monthly', '59 23 * * *', 1, 'Asia/Shanghai', NULL, 0, 0, 1, 1, 'github_trending.log', 1, NULL, 0, NULL, NULL);
```

> 说明：
>
> - command，应用程序中已经定义并且需要自动调度的 command
> - parameters，对应 command 执行时指定的参数
> - expression，执行时间间隔，cron 表达式
> - active，0 开启，1 关闭
> - output\_file\_path，指定 command 的输出的文件路径
> - output\_append，command 输出到文件时是否进行追加
> - output\_email，command 输出发送邮件
> - output\_email\_on\_failure，只在 command 执行失败时发送输出到邮件
> - 其他参数均可以在 laravel schedule 文档中找到相应的函数说明：

- 通过`php artisan schedule:list`检验是否配置成功

```
+------------------------------------------------------------------------+--------------+--------------------------+----------------------------+
| Command                                                                | Interval     | Description              | Next Due                   |
+------------------------------------------------------------------------+--------------+--------------------------+----------------------------+
| '/www/server/php/80/bin/php' 'artisan' github:trending                 | */10 * * * * | 爬取 Github daily 趋势   | 2021-06-22 21:40:00 +08:00 |
| '/www/server/php/80/bin/php' 'artisan' github:trending --since=weekly  | 59 23 * * *  | 爬取 Github weekly 趋势  | 2021-06-22 23:59:00 +08:00 |
| '/www/server/php/80/bin/php' 'artisan' github:trending --since=monthly | 59 23 * * *  | 爬取 Github monthly 趋势 | 2021-06-22 23:59:00 +08:00 |
+------------------------------------------------------------------------+--------------+--------------------------+----------------------------+
```

- 重启应用程序中的 `php artisan schedule:run`

以上，基于 schedules 数据表来管理调度任务就完成了。

协议
--

[](#协议)

MIT 许可证（MIT）。有关更多信息，请参见[协议文件](LICENSE)。

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance66

Regular maintenance activity

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

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

Total

8

Last Release

378d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a04a439041bd34c826a8cbfe7e2198c35a2106f74703cd1bec9710655905007?d=identicon)[dagasmart](/maintainers/dagasmart)

---

Top Contributors

[![dagasmart](https://avatars.githubusercontent.com/u/170431844?v=4)](https://github.com/dagasmart "dagasmart (1 commits)")

---

Tags

laravelscheduleextensionbizadmin

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dagasmart-task-schedule/health.svg)

```
[![Health](https://phpackages.com/badges/dagasmart-task-schedule/health.svg)](https://phpackages.com/packages/dagasmart-task-schedule)
```

###  Alternatives

[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

3786.5k](/packages/harris21-laravel-fuse)[matviib/scheduler

Service for scheduling and managing cron tasks in laravel application

213.3k](/packages/matviib-scheduler)[kunalvarma05/laravel-rabbitmq

Work with RabbitMQ in Laravel.

1853.7k](/packages/kunalvarma05-laravel-rabbitmq)

PHPackages © 2026

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