PHPackages                             mcfedr/php-resque-scheduler - 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. mcfedr/php-resque-scheduler

Abandoned → [mcfedr/queue-manager-bundle](/?search=mcfedr%2Fqueue-manager-bundle)Library[Queues &amp; Workers](/categories/queues)

mcfedr/php-resque-scheduler
===========================

php-resque-scheduler is a PHP port of resque-scheduler, which adds support for scheduling items in the future to Resque.

1.4.0(10y ago)021.1k22PHP

Since Mar 10Pushed 10y ago2 watchersCompare

[ Source](https://github.com/mcfedr/php-resque-scheduler)[ Packagist](https://packagist.org/packages/mcfedr/php-resque-scheduler)[ RSS](/packages/mcfedr-php-resque-scheduler/feed)WikiDiscussions master Synced today

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

php-resque-scheduler: PHP Resque Scheduler
==========================================

[](#php-resque-scheduler-php-resque-scheduler)

php-resque-scheduler is a PHP port of [resque-scheduler](http://github.com/defunkt/resque), which adds support for scheduling items in the future to Resque.

The PHP port of resque-scheduler has been designed to be an almost direct-copy of the Ruby plugin, and is designed to work with the PHP port of resque, [php-resque](http://github.com/chrisboulton/php-resque).

At the moment, php-resque-scheduler only supports delayed jobs, which is the ability to push a job to the queue and have it run at a certain timestamp, or in a number of seconds. Support for recurring jobs (similar to CRON) is planned for a future release.

Because the PHP port is almost a direct API copy of the Ruby version, it is also compatible with the web interface of the Ruby version, which provides the ability to view and manage delayed jobs.

Requirements
------------

[](#requirements)

- PHP 5.3+
- Redis 2.2+
- PHP-Resque 1.2+
- Optional but Recommended: Composer

Getting Started
---------------

[](#getting-started)

The easiest way to work with php-resque-scheduler is when it's installed as a Composer package inside your project. Composer isn't strictly required, but makes life a lot easier.

If you're not familiar with Composer, please see .

1. Add php-resque-scheduler to your application's composer.json.

    ```
    {
        ...
        "require": {
    		"chrisboulton/php-resque-scheduler": "dev-master",
            "php": ">=5.3.0"
        },
        ...
    }
    ```
2. Run `composer install`.
3. If you haven't already, add the Composer autoload to your project's initialization file. (example)

    ```
    require 'vendor/autoload.php';
    ```

Delayed Jobs
------------

[](#delayed-jobs)

To quote the documentation for the Ruby resque-scheduler:

> Delayed jobs are one-off jobs that you want to be put into a queue at some point in the future. The classic example is sending an email:

```
$in = 3600;
$args = array('id' => $user->id);
ResqueScheduler::enqueueIn($in, 'email', 'SendFollowUpEmail', $args);
```

The above will store the job for 1 hour in the delayed queue, and then pull the job off and submit it to the `email` queue in Resque for processing as soon as a worker is available.

Instead of passing a relative time in seconds, you can also supply a timestamp as either a DateTime object or integer containing a UNIX timestamp to the `enqueueAt` method:

```
$time = 1332067214;
ResqueScheduler::enqueueAt($time, 'email', 'SendFollowUpEmail', $args);

$datetime = new DateTime('2012-03-18 13:21:49');
ResqueScheduler::enqueueAt(datetime, 'email', 'SendFollowUpEmail', $args);
```

**Note:** resque-scheduler does not guarantee a job will fire at the time supplied. At the time supplied, resque-scheduler will take the job out of the delayed queue and push it to the appropriate queue in Resque. Your next available Resque worker will pick the job up. To keep processing as quick as possible, keep your queues as empty as possible.

Worker
------

[](#worker)

Like resque, resque-scheduler includes a worker that runs in the background. This worker is responsible for pulling items off the schedule/delayed queue and adding them to the queue for resque. This means that for delayed or scheduled jobs to be executed, the worker needs to be running.

A basic "up-and-running" resque-scheduler file that sets up a running worker environment is included in the bin/ directory.

To start a worker, it's very similar to the Ruby version:

```
$ LOGGING=1 php bin/resque-scheduler
```

It accepts many of the same environment variables as php-resque:

- `REDIS_BACKEND` - Redis server to connect to
- `LOGGING` - Enable logging to STDOUT
- `VERBOSE` - Enable verbose logging
- `VVERBOSE` - Enable very verbose logging
- `INTERVAL` - Sleep for this long before checking scheduled/delayed queues
- `APP_INCLUDE` - Include this file when starting (to launch your app)
- `PIDFILE` - Write the PID of the worker out to this file

The resque-scheduler worker requires resque to function. The demo resque-scheduler worker uses the Composer autoloader to load Resque.php.

It's easy to start the resque-scheduler worker using the included demo: $ bin/resque-scheduler

Event/Hook System
-----------------

[](#eventhook-system)

php-resque-scheduler uses the same event system used by php-resque and exposes the following additional events:

### afterSchedule

[](#afterschedule)

Called after a job has been added to the schedule. Arguments passed are the timestamp, queue of the job, the class name of the job, and the job's arguments.

### beforeDelayedEnqueue

[](#beforedelayedenqueue)

Called immediately after a job has been pulled off the delayed queue and right before the job is added to the queue in resque. Arguments passed are the queue of the job, the class name of the job, and the job's arguments.

Contributors
------------

[](#contributors)

- [chrisboulton](//github.com/chrisboulton)
- [rayward](//github.com/rayward)
- [atorres757](//github.com/atorres757)
- [tonypiper](//github.com/tonypiper)
- [biinari](//github.com/biinari)
- [cballou](//github.com/cballou)
- [danhunsaker](//github.com/danhunsaker)
- [evertharmeling](//github.com/evertharmeling)
- [stevelacey](//github.com/stevelacey)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

5

Last Release

3897d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7039999f29a83140d61116032ec1684c752412e458ad1999e15eea2f8808498c?d=identicon)[mcfedr](/maintainers/mcfedr)

---

Top Contributors

[![chrisboulton](https://avatars.githubusercontent.com/u/98472?v=4)](https://github.com/chrisboulton "chrisboulton (11 commits)")[![mcfedr](https://avatars.githubusercontent.com/u/704356?v=4)](https://github.com/mcfedr "mcfedr (5 commits)")[![robholmes](https://avatars.githubusercontent.com/u/206717?v=4)](https://github.com/robholmes "robholmes (4 commits)")[![rayward](https://avatars.githubusercontent.com/u/1217111?v=4)](https://github.com/rayward "rayward (3 commits)")[![danhunsaker](https://avatars.githubusercontent.com/u/1534396?v=4)](https://github.com/danhunsaker "danhunsaker (3 commits)")[![tonypiper](https://avatars.githubusercontent.com/u/206124?v=4)](https://github.com/tonypiper "tonypiper (1 commits)")[![cballou](https://avatars.githubusercontent.com/u/166784?v=4)](https://github.com/cballou "cballou (1 commits)")[![JaapRood](https://avatars.githubusercontent.com/u/857549?v=4)](https://github.com/JaapRood "JaapRood (1 commits)")[![biinari](https://avatars.githubusercontent.com/u/148009?v=4)](https://github.com/biinari "biinari (1 commits)")

### Embed Badge

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

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

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[amphp/parser

A generator parser to make streaming parsers simple.

14952.8M16](/packages/amphp-parser)[amphp/serialization

Serialization tools for IPC and data storage in PHP.

13451.1M18](/packages/amphp-serialization)[enqueue/enqueue

Message Queue Library

19820.0M56](/packages/enqueue-enqueue)[deliciousbrains/wp-background-processing

WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks.

1.1k409.8k6](/packages/deliciousbrains-wp-background-processing)[react/async

Async utilities and fibers for ReactPHP

2238.8M170](/packages/react-async)

PHPackages © 2026

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