PHPackages                             seatgeek/djjob - 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. seatgeek/djjob

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

seatgeek/djjob
==============

Allows PHP web applications to process long-running tasks asynchronously

1.0.0(8y ago)249235.3k↓56.9%56[6 issues](https://github.com/seatgeek/djjob/issues)2PHPPHP &gt;=5.1.0

Since Sep 12Pushed 8y ago29 watchersCompare

[ Source](https://github.com/seatgeek/djjob)[ Packagist](https://packagist.org/packages/seatgeek/djjob)[ RSS](/packages/seatgeek-djjob/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (2)

DJJob
=====

[](#djjob)

DJJob allows PHP web applications to process long-running tasks asynchronously. It is a PHP port of [delayed\_job](http://github.com/tobi/delayed_job) (developed at Shopify), which has been used in production at SeatGeek since April 2010.

Like delayed\_job, DJJob uses a `jobs` table for persisting and tracking pending, in-progress, and failed jobs.

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

[](#requirements)

- PHP5
- PDO (Ships with PHP &gt;= 5.1)
- (Optional) PCNTL library

Setup
-----

[](#setup)

Import the sql database table.

```
mysql db < jobs.sql

```

The `jobs` table structure looks like:

```
CREATE TABLE `jobs` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`handler` TEXT NOT NULL,
`queue` VARCHAR(255) NOT NULL DEFAULT 'default',
`attempts` INT UNSIGNED NOT NULL DEFAULT 0,
`run_at` DATETIME NULL,
`locked_at` DATETIME NULL,
`locked_by` VARCHAR(255) NULL,
`failed_at` DATETIME NULL,
`error` TEXT NULL,
`created_at` DATETIME NOT NULL
) ENGINE = INNODB;
```

> You may need to use BLOB as the column type for `handler` if you are passing in serialized blobs of data instead of record ids. For more information, see [this link](https://php.net/manual/en/function.serialize.php#refsect1-function.serialize-returnvalues) This may be the case for errors such as the following: `unserialize(): Error at offset 2010 of 2425 bytes`

Tell DJJob how to connect to your database:

```
DJJob::configure([
    'driver' => 'mysql',
    'host' => '127.0.0.1',
    'dbname' => 'djjob',
    'user' => 'root',
    'password' => 'topsecret',
]);
```

Usage
-----

[](#usage)

Jobs are PHP objects that respond to a method `perform`. Jobs are serialized and stored in the database.

```
