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

ActiveLibrary[Queues &amp; Workers](/categories/queues)

abuisine/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.2.1(9y ago)063.4kMITPHP

Since Mar 10Pushed 9y ago1 watchersCompare

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

READMEChangelog (3)DependenciesVersions (5)Used By (0)

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.

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:

```
require 'Resque/Resque.php';
require 'ResqueScheduler/ResqueScheduler.php';

$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:

```
require 'Resque/Resque.php';
require 'ResqueScheduler/ResqueScheduler.php';

$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.php file is included that sets up a running worker environment is included in the root directory. 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.php worker allows you to supply a `RESQUE_PHP` environment variable with the path to Resque.php. If not supplied and resque is not already loaded, resque-scheduler will attempt to load it from your include path (`require_once 'Resque/Resque.php';'`)

It's easy to start the resque-scheduler worker using resque-scheduler.php: $ RESQUE\_PHP=../resque/lib/Resque/Resque.php php resque-scheduler.php

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

[](#eventhook-system)

php-resque-scheduler uses the same event system used by php-resque and exposes the following 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
- rayward
- atorres757
- tonypiper
- biinari
- cballou

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity66

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

Total

4

Last Release

3301d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d83af4cdf5c7fd47cabed24c4cb15c60db17b96379e80880c0d372371a2f15d?d=identicon)[abuisine](/maintainers/abuisine)

---

Top Contributors

[![chrisboulton](https://avatars.githubusercontent.com/u/98472?v=4)](https://github.com/chrisboulton "chrisboulton (14 commits)")[![abuisine](https://avatars.githubusercontent.com/u/1078681?v=4)](https://github.com/abuisine "abuisine (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)")[![JaapRood](https://avatars.githubusercontent.com/u/857549?v=4)](https://github.com/JaapRood "JaapRood (1 commits)")[![mhagstrand](https://avatars.githubusercontent.com/u/685532?v=4)](https://github.com/mhagstrand "mhagstrand (1 commits)")[![smalot](https://avatars.githubusercontent.com/u/1424035?v=4)](https://github.com/smalot "smalot (1 commits)")[![spekulatius](https://avatars.githubusercontent.com/u/8433587?v=4)](https://github.com/spekulatius "spekulatius (1 commits)")[![tonypiper](https://avatars.githubusercontent.com/u/206124?v=4)](https://github.com/tonypiper "tonypiper (1 commits)")[![biinari](https://avatars.githubusercontent.com/u/148009?v=4)](https://github.com/biinari "biinari (1 commits)")[![cballou](https://avatars.githubusercontent.com/u/166784?v=4)](https://github.com/cballou "cballou (1 commits)")[![danhunsaker](https://avatars.githubusercontent.com/u/1534396?v=4)](https://github.com/danhunsaker "danhunsaker (1 commits)")

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/abuisine-php-resque-scheduler/health.svg)](https://phpackages.com/packages/abuisine-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)
