PHPackages                             jiannei/laravel-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jiannei/laravel-schedule

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

jiannei/laravel-schedule
========================

More flexible way to manage your Laravel schedule tasks.

v2.0.0(3y ago)191.9k↓77.8%3MITPHPCI passing

Since Jun 22Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/jiannei/laravel-schedule)[ Packagist](https://packagist.org/packages/jiannei/laravel-schedule)[ RSS](/packages/jiannei-laravel-schedule/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

laravel-schedule
================

[](#laravel-schedule)

> ⏱ More flexible way to manage your Laravel schedule tasks. - 更灵活地管理 Laravel 应用中的任务调度。

[![StyleCI](https://camo.githubusercontent.com/3fd71cf56fd32beac4f1239febdb14eef930d34c5eea33addb32aa4380a44845/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3337373035363736332f736869656c643f7374796c653d666c6174266272616e63683d6d61696e)](https://camo.githubusercontent.com/3fd71cf56fd32beac4f1239febdb14eef930d34c5eea33addb32aa4380a44845/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3337373035363736332f736869656c643f7374796c653d666c6174266272616e63683d6d61696e)[![Latest Stable Version](https://camo.githubusercontent.com/1fb9499eb7a6fc00916e4279ae3a2cd14b21755a7c5c6ea4d23f2c1a45a43254/68747470733a2f2f706f7365722e707567782e6f72672f6a69616e6e65692f6c61726176656c2d7363686564756c652f76)](https://packagist.org/packages/jiannei/laravel-schedule)[![Total Downloads](https://camo.githubusercontent.com/56127d08bbf77a0476fcb40e111e7c3aa7bf8654003752b563d9bf03224cee7a/68747470733a2f2f706f7365722e707567782e6f72672f6a69616e6e65692f6c61726176656c2d7363686564756c652f646f776e6c6f616473)](https://packagist.org/packages/jiannei/laravel-schedule)[![Monthly Downloads](https://camo.githubusercontent.com/e6e756f280dd1c56cf78de3955d5b79f365974424948cc76224a69e0cecc1672/68747470733a2f2f706f7365722e707567782e6f72672f6a69616e6e65692f6c61726176656c2d7363686564756c652f642f6d6f6e74686c79)](https://packagist.org/packages/jiannei/laravel-schedule)[![Version](https://camo.githubusercontent.com/4f965c85885db2265724ecab4535f5a7bf5ac6951ce3dd73b5a1b2810e7736e3/68747470733a2f2f706f7365722e707567782e6f72672f6a69616e6e65692f6c61726176656c2d7363686564756c652f76657273696f6e)](https://packagist.org/packages/jiannei/laravel-schedule)[![License](https://camo.githubusercontent.com/d08038d1dbf59d7ed32d3dde83f91522c92860763478d67f390072b16e40197d/68747470733a2f2f706f7365722e707567782e6f72672f6a69616e6e65692f6c61726176656c2d7363686564756c652f6c6963656e7365)](https://packagist.org/packages/jiannei/laravel-schedule)

社区讨论文章
------

[](#社区讨论文章)

- [是时候使用 Lumen 8 + API Resource 开发项目了！](https://learnku.com/articles/45311)
- [教你更优雅地写 API 之「路由设计」](https://learnku.com/articles/45526)
- [教你更优雅地写 API 之「规范响应数据」](https://learnku.com/articles/52784)
- [教你更优雅地写 API 之「枚举使用」](https://learnku.com/articles/53015)
- [教你更优雅地写 API 之「记录日志」](https://learnku.com/articles/53669)
- [教你更优雅地写 API 之「灵活地任务调度」](https://learnku.com/articles/58403)

功能
--

[](#功能)

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

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

安装和配置
-----

[](#安装和配置)

- 安装

```
$ composer require jiannei/laravel-schedule -vvv
```

- 发布服务

```
$ php artisan vendor:publish --provider="Jiannei\Schedule\Laravel\Providers\LaravelServiceProvider"
```

- 执行迁移

```
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

40

—

FairBetter than 86% of packages

Maintenance55

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.9% 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 ~292 days

Total

3

Last Release

1246d ago

Major Versions

v1.0.1 → v2.0.02023-01-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/1976f3bc442d9f7db752da3a494a9174132ea498d3338495b1978b1499032b45?d=identicon)[jiannei](/maintainers/jiannei)

---

Top Contributors

[![jiannei](https://avatars.githubusercontent.com/u/46595807?v=4)](https://github.com/jiannei "jiannei (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

laravellaravel-packageschedulelaravelschedule

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jiannei-laravel-schedule/health.svg)

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

###  Alternatives

[laraveljutsu/zap

A flexible, performant, and developer-friendly schedule management system for Laravel

1.5k97.9k1](/packages/laraveljutsu-zap)[llaski/nova-scheduled-jobs

A Laravel Nova package to view your scheduled jobs.

54442.0k](/packages/llaski-nova-scheduled-jobs)[skywarth/chaotic-schedule

Randomize scheduled command execution time and date intervals

12252.0k](/packages/skywarth-chaotic-schedule)[indeev/laravel-schedule-calendar

Laravel Schedule Calendar - a package providing developers with a concise and visual representation of scheduled tasks, enabling easy analysis of load distribution throughout the day or week for optimized task scheduling.

558.4k](/packages/indeev-laravel-schedule-calendar)[mvenghaus/filament-plugin-schedule-monitor

Filament Plugin for Spatie's Schedule Monitor

1554.4k1](/packages/mvenghaus-filament-plugin-schedule-monitor)[tkachikov/chronos

Settings commands for Laravel Scheduling

183.9k](/packages/tkachikov-chronos)

PHPackages © 2026

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