PHPackages                             selff/yii2-gearman - 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. selff/yii2-gearman

ActiveYii2-extension[Queues &amp; Workers](/categories/queues)

selff/yii2-gearman
==================

simple client for gearman queue

069PHP

Since Jul 27Pushed 7y ago1 watchersCompare

[ Source](https://github.com/selff/yii2-gearman)[ Packagist](https://packagist.org/packages/selff/yii2-gearman)[ RSS](/packages/selff-yii2-gearman/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-gearman
============

[](#yii2-gearman)

Simple client for gearman queue

```
// config/console.php

'gearman' => [
    'class' => 'selff\yii2\gearman\GearmanComponent',
    'servers' => [
        [
            'host' => '127.0.0.1',
            'port' => 4730
        ],
    ],
],

// composer.json

"require": {
    ...
    "selff/yii2-gearman": "dev-master"
},

// Client example

namespace app\commands;

use Yii;
use yii\console\Controller;
use selff\yii2\gearman\GearmanComponent;

class ExampleController extends Controller
{
    public function complete($task)
    {
        echo "handle: ".$task->jobHandle().PHP_EOL;
        echo "returned: ";
        print_r(json_decode($task->data()));
    }

    public function actionRunTask()
    {

        Yii::$app->gearman->client()->setCompleteCallback([$this,"complete"]);
        Yii::$app->gearman->client()->addTask('taskName', json_encode(['data' => 1]));
        if (! Yii::$app->gearman->client()->runTasks())
        {
            echo "ERROR " . Yii::$app->gearman->client()->error() . PHP_EOL;
            exit;
        }
        echo "DONE".PHP_EOL;
    }
}

// Outer worker script example

echo "Starting\n";

$gmworker= new GearmanWorker();
$gmworker->addServer();
$gmworker->addFunction("taskName", "myfunc");

print "Waiting for job...\n";
while($gmworker->work())
{
  if ($gmworker->returnCode() != GEARMAN_SUCCESS)
  {
    echo "return_code: " . $gmworker->returnCode() . "\n";
    break;
  }
}

function myfunc($job)
{
  echo "Received job: " . $job->handle() . PHP_EOL;
  $workload = json_decode($job->workload(),1);
  foreach($workload as $key=>$value) {
    if (is_numeric($value)) $workload[$key] = $value+1;
  }
  return json_encode($workload);
}

// run client

yii example/run-task

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b61b35d618ea892553d0de848f2f86037bda286e330b278feeeb7d84fda2b5d9?d=identicon)[selff](/maintainers/selff)

---

Top Contributors

[![selff](https://avatars.githubusercontent.com/u/356983?v=4)](https://github.com/selff "selff (8 commits)")

### Embed Badge

![Health badge](/badges/selff-yii2-gearman/health.svg)

```
[![Health](https://phpackages.com/badges/selff-yii2-gearman/health.svg)](https://phpackages.com/packages/selff-yii2-gearman)
```

###  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.8M171](/packages/react-async)

PHPackages © 2026

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