承接 pnixx/delayed_job 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pnixx/delayed_job

最新稳定版本:3.0.2

Composer 安装命令:

composer require pnixx/delayed_job

包简介

Async Delayed Job for PHP

README 文档

README

Simple, efficient background processing for PHP uses threads to handle many jobs.

Requirements

  • PHP 8.1+
  • Redis 2.2+
  • Composer

Installation

composer require pnixx/delayed_job

Worker process

Simple run worker process in background:

bin/run start

Extend run worker process:

bin/run start --process 5 --queue mailer -i /path/to/init.php

For list all commands, please use --help or -h argument.

For restart process after deploy use --restart or -r argument. A new process will be waiting finish all running processes.

Jobs

Job class required include perform method:

class TestJob extends PNixx\DelayedJob\Job { public function perform($args = []): void { //Work process } }

Any exception thrown by a job will be returned job to work with timeout. If you want set limit attempt for retries job, set $attempt in you class.

Jobs can also have setup and completed methods. If a setup method is defined, it will be called before the perform method. The completed method will be called after success job.

class TestJob extends PNixx\DelayedJob\Job { /**  * Queue for publishing Job  */ public static string $queue = 'mailer'; /**  * Attempt count used for only delayed tasks  * default: 0 - always repeat until it reach success  */ public static $attempt = 0; public function setup() { //Setup this job } public function perform($args = []): void { //Work process } public function completed() { //Complete job callback } }

Queueing jobs

Jobs can run in current thread uses now method. If you use this, you can handle the exceptions in a job failing.

//Run job in this thread without arguments TestJob::now(); //Run job in this thread with arguments TestJob::now(['name' => 'Jane']);

Jobs can run in a background thread or add to scheduler.

//Run job in a background TestJob::later(); //Run job in a background with arguments TestJob::later(['name' => 'Jane']); //Add job in a scheduler. TestJob::later(['name' => 'Jane'], strtotime('+1 day'));

Signals

  • QUIT - Wait for job to finish processing then exit
  • TERM / INT - Immediately kill job then exit without saving data

Author

Sergey Odintsov, @pnixx

统计信息

  • 总下载量: 2.2k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 1

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固