PHPackages                             josegonzalez/cakephp-cake-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. josegonzalez/cakephp-cake-djjob

AbandonedArchivedCakephp-plugin[Queues &amp; Workers](/categories/queues)

josegonzalez/cakephp-cake-djjob
===============================

job queues for cakephp using seatgeek's djjob — Edit

37712PHP

Since Nov 29Pushed 10y ago5 watchersCompare

[ Source](https://github.com/josegonzalez/cakephp-cake-djjob)[ Packagist](https://packagist.org/packages/josegonzalez/cakephp-cake-djjob)[ RSS](/packages/josegonzalez-cakephp-cake-djjob/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/4533c92eb47bade1354c6312401959cf1fac6ca0564c4d4b7ebb96ef212e7bad/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a6f7365676f6e7a616c657a2f63616b657068702d63616b652d646a6a6f622f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/josegonzalez/cakephp-cake-djjob)[![Coverage Status](https://camo.githubusercontent.com/3d0c7e761c1462daa0b55b3d9729575aa0fae3a46e0d8a45b1b6e163cbad2718/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6a6f7365676f6e7a616c657a2f63616b657068702d63616b652d646a6a6f622e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/josegonzalez/cakephp-cake-djjob?branch=master)[![Total Downloads](https://camo.githubusercontent.com/ac17deea0d4244adddd7774193cef4b39e8b2a873846358058f418f8f392af30/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6f7365676f6e7a616c657a2f63616b657068702d63616b652d646a6a6f622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/josegonzalez/cakephp-cake-djjob)[![Latest Stable Version](https://camo.githubusercontent.com/d7111d5b1f8b26a6d509555dffb7d835bb1ff827b3d516f2789ffb479fc6725b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f7365676f6e7a616c657a2f63616b657068702d63616b652d646a6a6f622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/josegonzalez/cakephp-cake-djjob)[![Documentation Status](https://camo.githubusercontent.com/2e9e17bf34d25b3af47fb461f29f7e2db9dcb94d7f64ceaeac176fc925c56d14/68747470733a2f2f72656164746865646f63732e6f72672f70726f6a656374732f63616b657068702d63616b652d646a6a6f622f62616467652f3f76657273696f6e3d6c6174657374267374796c653d666c61742d737175617265)](https://readthedocs.org/projects/cakephp-cake-djjob/?badge=latest)[![Gratipay](https://camo.githubusercontent.com/40a48c7b3fc02e9d39dd715fe09e404c4cb2e89288c6ace0773d2aab6913b46f/68747470733a2f2f696d672e736869656c64732e696f2f67726174697061792f6a6f7365676f6e7a616c657a2e7376673f7374796c653d666c61742d737175617265)](https://gratipay.com/~josegonzalez/)

Cake DJJob Plugin
=================

[](#cake-djjob-plugin)

Quick and easy job queues, based on delayed\_job

Background
----------

[](#background)

[CakePackages](http://github.com/josegonzalez/cakepackages) is the type of site that would do well with background processes. Rather than try to build - and fail - a job/worker system, I set out to wrap an existing system.

I am aware of a few plugins for cakephp, notably the [queue](https://github.com/davidpersson/queue) plugin by David Persson, and the [cron-mailer](https://github.com/kalt/cron-mailer) plugin by Pierre-Emmanuel Fringant. However, I don't wish to run and maintain yet another service, and my cron tasks aren't email-based at all. The other thing was the lack of documentation for David's plugin, and I am hesitant to familiarize myself with so many tools at once.

At [SeatGeek](http://seatgeek.com), we use a [PHP port](http://github.com/seatgeek/djjob) of [delayed\_job](https://github.com/collectiveidea/delayed_job), which works very well in production. It's a neat little set of classes that abstracts away most of the pain of creating new jobs and workers. Unfortunately, the only system I've ever used it in was Symfony (you'll notice we include a sample Symfony task with the package).

So here this is, Cake DJJob. Use it and abuse it to create Jobs/workers whenever necessary :)

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

[](#requirements)

- CakePHP 1.3
- Patience
- PHP 5
- PDO (Ships with PHP &gt;= 5.1)
- (Optional) PCNTL library

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

[](#installation)

You are required to install both `djjob` and `cake_djjob`. Note that you'll need a `jobs` table just like the one included with `djjob`. A `cake_schema` file is forthcoming.

### DJJob Installation

[](#djjob-installation)

*\[Manual\]*

- Download this:
- Unzip that download.
- Copy the resulting folder to app/plugins
- Rename the folder you just copied to `Djjob/Vendor`

*\[GIT Submodule\]*

In your app directory type:

```
git submodule add git://github.com/seatgeek/djjob.git Plugin/Djjob/Vendor
git submodule init
git submodule update

```

*\[GIT Clone\]*

In your plugin directory type

```
git clone git://github.com/seatgeek/djjob.git Djjob/Vendor

```

h3. Cake DJJob Installation

*\[Manual\]*

- Download this: [http://github.com/josegonzalez/cake\_djjob/zipball/master](http://github.com/josegonzalez/cake_djjob/zipball/master)
- Unzip that download.
- Copy the resulting folder to app/Plugin
- Rename the folder you just copied to `CakeDjjob`

*\[GIT Submodule\]*

In your app directory type:

```
git submodule add git://github.com/josegonzalez/cake_djjob.git Plugin/CakeDjjob
git submodule init
git submodule update

```

*\[GIT Clone\]*

In your Plugin directory type

```
git clone git://github.com/josegonzalez/cake_djjob.git CakeDjjob

```

Usage
-----

[](#usage)

### Creating New Jobs

[](#creating-new-jobs)

You can create new jobs in the `Lib/Job` folder of your application or of any plugin. When creating plugin jobs, the plugin name must be in the job class name, but not the job class file. For example, the `CakeDjjob` plugin contains a `CakeDjjob_TestJob` in `Lib/Job/TestJob.php`. All plugins must be separated from the job classname using an underscore, and there can only be one underscore in a classname. This is so you can use jobs from plugins as well as from the application.

Jobs respond to a `perform()` method, as in [djjob](http://github.com/seatgeek/djjob). In `CakeDjjob`, all jobs should extend the `CakeJob` class. This is not required, but it allows for increased base functionality in your jobs. For example, an application's `ForgotPasswordJob` might be composed as follows:

```
