Yii 1.1: gearman

A gearman wrapper for yii framework


Tested under Yii 1.1.6. Require PHP Gearman extension installed.


Extract the files into the extension directory and change the config like bellow:

'components' => array(
        'gearman' => array(
            'class' => 'ext.Gearman',
            'servers' => array(
                array('host' => '', 'port' => 4731),

Simple example:

// Client example
Yii::app()->gearman->client()->doBackground("reverse", "Hello world!");
// Worker example
function reverse($job)
    return strrev($job->workload());
Yii::app()->gearman->worker()->addFunction("reverse", array($this, 'reverse'));
while($worker->work()) { echo "Done!"; }


Total 3 comments

#4426 report it
Maciej Liżewski at 2011/07/07 08:52am

Thanks to this extension I have learned about Gearman project and it seems quite interesting!

#3676 report it
intel352 at 2011/04/27 10:16am
A bit too limited

This extension is really just a wrapper of the Gearman client/worker classes. For someone looking for a complete solution, this appears to be a good choice: https://github.com/mitallast/yii-gearman

#3655 report it
intel352 at 2011/04/26 12:30pm

Glad to see someone already put together a Gearman ext for Yii. Installing it today :-)

Leave a comment

Please to leave your comment.

Create extension