PHPackages                             softwarepunt/php-resque - 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. [Caching](/categories/caching)
4. /
5. softwarepunt/php-resque

ActiveLibrary[Caching](/categories/caching)

softwarepunt/php-resque
=======================

Redis backed library for creating background jobs and processing them later. Based on resque for Ruby.

v1.5.0(1y ago)0442MITPHPPHP &gt;=8.2

Since Aug 1Pushed 1y ago2 watchersCompare

[ Source](https://github.com/SoftwarePunt/php-resque)[ Packagist](https://packagist.org/packages/softwarepunt/php-resque)[ Docs](http://www.github.com/chrisboulton/php-resque/)[ RSS](/packages/softwarepunt-php-resque/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

php-resque
==========

[](#php-resque)

**php-resque is a Redis-based library for enqueuing and running background jobs.**

This is a lightly maintained fork of **chrisboulton/php-resque**, with fixes and improvements, compatible with PHP 8.2+.

⚠️ Not recommended for new projects. We are only maintaining this for legacy projects.

Installation
------------

[](#installation)

Add the package with composer:

```
composer require softwarepunt/php-resque
```

Usage
-----

[](#usage)

### Configuration

[](#configuration)

If you are not using default Redis configuration, set the backend manually:

```
Resque::setBackend('localhost:6379');
```

### Define jobs

[](#define-jobs)

Each job should be in its own class, and include a perform method:

```
namespace MyApp;

class Greeter_Job
{
    public function setUp()
    {
        // Optional: Set up before (called before perform())
    }

    public function perform()
    {
        // Required: Main work method

        // Perform work; context data is accessible from $this->args
        echo "Hello, {$this->args['name']}!";
    }

    public function tearDown()
    {
        // Optional: Tear down after (called after job finishes)
    }
}
```

### Enqueue jobs

[](#enqueue-jobs)

Jobs instances are placed in specific queues with a set of context data (args):

```
// Enqueue an instance of "My_Job" in the "default" queue
Resque::enqueue('default', 'MyApp\Greeter_Job', ['name' => "Hank"]);
```

### Dequeue jobs

[](#dequeue-jobs)

Jobs can be removed from queues:

```
// Remove all jobs of a certain type from a queue
Resque::dequeue('default', ['MyApp\Greeter_Job']);

// Remove specific job from a queue
Resque::dequeue('default', ['MyApp\Greeter_Job' => '087df5819a790ac666c9608e2234b21e']);
```

### Workers

[](#workers)

Start a worker with the `QUEUE` environment variable to begin processing jobs from that queue:

```
QUEUE=default php vendor/bin/resque
```

#### Environment variables

[](#environment-variables)

You can set the following environment variables on the worker:

NameDescription`QUEUE`Required. Defines one or more comma-separated queues to process tasks from. Set to `*` to process from any queue.`APP_INCLUDE`Optional. Defines a bootstrap script to run before starting the worker.`PREFIX`Optional. Prefix to use in Redis.`COUNT`Optional. Amount of worker forks to start. If set to &gt; 1, the process will start the workers and then exit immediately.`SCHEDULE`Optional. An expression with a from/until time, e.g. `22:00-06:00` to only run tasks between 10pm and 6am. The worker is paused outside of the schedule. Relative to default timezone (`date_default_timezone_set`).`VERBOSE`Optional. Forces verbose log output.`VVERBOSE`Optional. Forces detailed verbose log output.### Events

[](#events)

You can listen for specific events to track status changes:

```
Resque_Event::listen('eventName', $callback);
```

`$callback` may be anything in PHP that is callable by `call_user_func_array`.

NameDescriptionEvent arguments`beforeFirstFork`Called once, as a worker initializes.`Resque_Worker $worker``beforeFork`Called before php-resque forks to run a job.`Resque_Job $job``afterFork`Called after php-resque forks to run a job (but before the job is run).`Resque_Job $job``beforePerform`Called once per job run, before `setUp` and `perform`.`Resque_Job $job``afterPerform`Called once per job run, after `perform` and `tearDown`.`Resque_Job $job``onFailure`Called whenever a job fails.`Exception $ex, Resque_Job $job``beforeEnqueue`Called before a job has been queued using `enqueue`.`string $class, ?array $args, string $queue, string $id``afterEnqueue`Called after a job has been queued using `enqueue`.`string $class, ?array $args, string $queue, string $id`Advanced
--------

[](#advanced)

### Getting self job info

[](#getting-self-job-info)

You can get the ID, queue, etc. from within an executing job:

```
public function perform()
{
    echo $this->queue; // my_queue (Queue name)
    echo $this->job->payload['id']; // aa4c8b768d7b89a1b90d000cfefdf785 (Job ID)
    echo $this->job->payload['queue_time']; // 1695993877.3551 (Job enqueued at)
}
```

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance51

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.4% 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 ~316 days

Total

3

Last Release

380d ago

### Community

Maintainers

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

---

Top Contributors

[![chrisboulton](https://avatars.githubusercontent.com/u/98472?v=4)](https://github.com/chrisboulton "chrisboulton (110 commits)")[![roydejong](https://avatars.githubusercontent.com/u/6772638?v=4)](https://github.com/roydejong "roydejong (26 commits)")[![ruudk](https://avatars.githubusercontent.com/u/104180?v=4)](https://github.com/ruudk "ruudk (22 commits)")[![danhunsaker](https://avatars.githubusercontent.com/u/1534396?v=4)](https://github.com/danhunsaker "danhunsaker (5 commits)")[![hobodave](https://avatars.githubusercontent.com/u/12404?v=4)](https://github.com/hobodave "hobodave (4 commits)")[![richardkmiller](https://avatars.githubusercontent.com/u/563438?v=4)](https://github.com/richardkmiller "richardkmiller (3 commits)")[![kevburnsjr](https://avatars.githubusercontent.com/u/20638?v=4)](https://github.com/kevburnsjr "kevburnsjr (3 commits)")[![wedy](https://avatars.githubusercontent.com/u/232968?v=4)](https://github.com/wedy "wedy (3 commits)")[![Rockstar04](https://avatars.githubusercontent.com/u/641721?v=4)](https://github.com/Rockstar04 "Rockstar04 (3 commits)")[![patrickbajao](https://avatars.githubusercontent.com/u/383183?v=4)](https://github.com/patrickbajao "patrickbajao (2 commits)")[![pedroarnal](https://avatars.githubusercontent.com/u/860007?v=4)](https://github.com/pedroarnal "pedroarnal (2 commits)")[![bc-vincent-zhao](https://avatars.githubusercontent.com/u/2160148?v=4)](https://github.com/bc-vincent-zhao "bc-vincent-zhao (2 commits)")[![drahmel](https://avatars.githubusercontent.com/u/722938?v=4)](https://github.com/drahmel "drahmel (2 commits)")[![ebernhardson](https://avatars.githubusercontent.com/u/558434?v=4)](https://github.com/ebernhardson "ebernhardson (2 commits)")[![jaswdr](https://avatars.githubusercontent.com/u/6409113?v=4)](https://github.com/jaswdr "jaswdr (2 commits)")[![lauripiisang](https://avatars.githubusercontent.com/u/5603529?v=4)](https://github.com/lauripiisang "lauripiisang (2 commits)")[![lboynton](https://avatars.githubusercontent.com/u/98873?v=4)](https://github.com/lboynton "lboynton (2 commits)")[![luishdez](https://avatars.githubusercontent.com/u/38347?v=4)](https://github.com/luishdez "luishdez (2 commits)")[![maetl](https://avatars.githubusercontent.com/u/24809?v=4)](https://github.com/maetl "maetl (2 commits)")[![mickhrmweb](https://avatars.githubusercontent.com/u/1262124?v=4)](https://github.com/mickhrmweb "mickhrmweb (2 commits)")

---

Tags

redisjobbackgroundresque

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/softwarepunt-php-resque/health.svg)

```
[![Health](https://phpackages.com/badges/softwarepunt-php-resque/health.svg)](https://phpackages.com/packages/softwarepunt-php-resque)
```

###  Alternatives

[resque/php-resque

Redis backed library for creating background jobs and processing them later. Based on resque for Ruby.

2371.8M7](/packages/resque-php-resque)

PHPackages © 2026

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