PHPackages                             ydin/jobman - 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. ydin/jobman

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

ydin/jobman
===========

0.1.0(6y ago)038MITPHPPHP &gt;=7.1.0

Since Sep 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/glennfriend/ydin-jobman)[ Packagist](https://packagist.org/packages/ydin/jobman)[ RSS](/packages/ydin-jobman/feed)WikiDiscussions master Synced today

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

Jobman
------

[](#jobman)

- horizon + dispatch jobs

### Jobman flow

[](#jobman-flow)

1. 產生一個需要進入 queue 的 'hello' 工作, 準備好該內容
2. 建立資料 type=hello, attribs={json...} 到 'jobmans' table
3. job 可能會因為失敗而執行多次, jobmans table 只會留下一部份的足跡
4. 如果你有開啟 worker server, 那麼工作就會進入 jobman flow

### Jobman flow picture

[](#jobman-flow-picture)

[![flow](doc/jobman.png)](doc/jobman.png)

### laravel table

[](#laravel-table)

- 用到 laravel 提供的 "failed\_jobs" table, 該程式會建立這些 tables

### dependency

[](#dependency)

- redis
- laravel horizon package
- laravel horizon config file
- database: laravel table "failed\_jobs"

### enable horizon

[](#enable-horizon)

```
# 參數 --environment=local 的使用情況非常不穩定, 不使用 at laravel 5.8.26
php artisan horizon
google-chrome http://127.0.0.1:8000/horizon/dashboard

```

### 查看現在的情況

[](#查看現在的情況)

```
php artisan horizon:status
php artisan horizon:list

```

### 修正程式後, 重試失敗的 job

[](#修正程式後-重試失敗的-job)

```
php artisan horizon:terminate   # 修正程式後, 要重新啟動
php artisan horizon             # 如果有建立並且啟用 supervisor, 消失時會自動啟動
php artisan queue:retry 5       # "failed_jobs" table "id" field
php artisan queue:retry all

```

### 如何建立一個新的 job

[](#如何建立一個新的-job)

1. 參考程式 src/Jobs/HelloWorldJob.php
2. 建立程式 job 在任意的路徑
3. 新增設定 config/jobman.php
4. 新增設定 config/horizon.php
5. 重新執行 php artisan horizon
6. 重新啟動 supervisor (option)
7. trigger your code, 參考 src/Console/Commands/TryHelloCommand.php

### jobmans 部份的欄位說明

[](#jobmans-部份的欄位說明)

- attribs
    - 傳遞 job 需要的訊息
    - 有些 job 需要返還值, 也可以回存在這裡
- logs
    - 希望在 job 裡面留下操作的記錄
    - 這些記錄是發生問題才需要查看
    - 所以不希望留在 laravel.log
    - 可以記在這裡
- error\_message
    - 保留最後一次的 $exception-&gt;getMessage()
- exception
    - 保留最後一次的 Exception
- failed\_at
    - 如果曾經失敗過, 在成功之後, 還是會保留該值
- completed\_at
    - 完成任務, 但不代表結果是正確的, 有些結果不是只有一種
- completed\_code
    - 通常是 null
    - 如果結果不是只有一種, 可以存在這裡
    - 例如
        - 將資料加到資料庫, 但是該資料已存在, 但是這兩種情況都符合 job 之目的
            - success
            - already-exists
        - 非同步的方式刪除一個 blog, 如果不存在, 就結束工作
            - success
            - blog-not-found

### 應做未做的部份

[](#應做未做的部份)

- 超過 6 個月的資料可以刪除

    - SELECT \* FROM `jobmans` WHERE created\_at &lt; DATE\_SUB(NOW(), INTERVAL 180 DAY);
- 未加入 queue 的 Jobman

    - Jobman push() 的時候如果沒有開啟 redis
    - 那麼這些 jobmans 將永遠不會被執行到
    - 建立一個 console command 將這些 jobman 丟到 redis
    - 該功能一方面也可以再次執行 jobman

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Unknown

Total

1

Last Release

2443d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cf57aeaf9b900503c94347af79a5e257a33b5c58177084074a6feb45b3fef609?d=identicon)[glennfriend](/maintainers/glennfriend)

---

Top Contributors

[![glennprofile](https://avatars.githubusercontent.com/u/25604752?v=4)](https://github.com/glennprofile "glennprofile (3 commits)")

### Embed Badge

![Health badge](/badges/ydin-jobman/health.svg)

```
[![Health](https://phpackages.com/badges/ydin-jobman/health.svg)](https://phpackages.com/packages/ydin-jobman)
```

###  Alternatives

[mettle/sendportal

SendPortal. Open-source self-hosted email marketing. Manage your own newsletters at a fraction of the cost.

2.1k4.3k](/packages/mettle-sendportal)[appstract/nova-horizon

Horizon statistics in Nova

77276.5k](/packages/appstract-nova-horizon)[mad-web/nova-horizon-link

Smart Link for Laravel Nova to Horizon Dashboard.

24201.4k](/packages/mad-web-nova-horizon-link)[huangdijia/laravel-horizon-restart

Horizon Restart for Laravel.

23103.9k](/packages/huangdijia-laravel-horizon-restart)[inovector/mixpostapp

Standalone application with the Laravel Package of Mixpost Lite pre-installed and configured

1232.9k](/packages/inovector-mixpostapp)

PHPackages © 2026

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