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

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

shakura/yii2-gearman
====================

Gearman handler for PHP

2753.2k↓50%28[5 issues](https://github.com/shakura/yii2-gearman/issues)[3 PRs](https://github.com/shakura/yii2-gearman/pulls)PHP

Since Nov 2Pushed 8y ago3 watchersCompare

[ Source](https://github.com/shakura/yii2-gearman)[ Packagist](https://packagist.org/packages/shakura/yii2-gearman)[ RSS](/packages/shakura-yii2-gearman/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#yii2-gearman)

This extension built on [this](https://github.com/Filsh/yii2-gearman) and [this](https://github.com/sinergi/gearman). The goal of the project is opportunity of starting multiple worker processes on one machine.

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

[](#installation)

It is recommended that you install the Gearman library [through composer](http://getcomposer.org/). To do so, add the following lines to your `composer.json` file.

```
{
    "require": {
       "shakura/yii2-gearman": "dev-master"
    }
}
```

Configuration
-------------

[](#configuration)

```
'components' => [
  'gearman' => [
      'class' => 'shakura\yii2\gearman\GearmanComponent',
      'servers' => [
          ['host' => '127.0.0.1', 'port' => 4730],
      ],
      'user' => 'www-data',
      'jobs' => [
          'syncCalendar' => [
              'class' => 'common\jobs\SyncCalendar'
          ],
          ...
      ]
  ]
],
...
'controllerMap' => [
    'gearman' => [
        'class' => 'shakura\yii2\gearman\GearmanController',
        'gearmanComponent' => 'gearman'
    ],
    ...
],
```

Job example
-----------

[](#job-example)

```
namespace common\jobs;

use shakura\yii2\gearman\JobBase;

class SyncCalendar extends JobBase
{
    public function execute(\GearmanJob $job = null)
    {
        // Do something
    }
}
```

Manage workers
--------------

[](#manage-workers)

```
yii gearman/start 1 // start the worker with unique id
yii gearman/restart 1 // restart worker
yii gearman/stop 1 // stop worker
```

Example using Dispatcher
------------------------

[](#example-using-dispatcher)

```
Yii::$app->gearman->getDispatcher()->background('syncCalendar', new JobWorkload([
    'params' => [
        'data' => 'value'
    ]
])); // run in background
Yii::$app->gearman->getDispatcher()->execute('syncCalendar', new JobWorkload([
    'params' => [
        'data' => 'value'
    ]
])); // run synchronize
```

Example of [Supervisor](http://supervisord.org/) config to manage multiple workers
----------------------------------------------------------------------------------

[](#example-of-supervisor-config-to-manage-multiple-workers)

```
[program:yii-gearman-worker]
command=php [path_to_your_app]/yii gearman/start %(process_num)s
process_name=gearman-worker-%(process_num)s
priority=1
numprocs=5
numprocs_start=1
autorestart=true

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% 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/dd120c0f2caf651a7bb64ef7a8e4adc456aed280cfa9a7bc565ecdde1d0963d1?d=identicon)[shakura](/maintainers/shakura)

---

Top Contributors

[![shakura](https://avatars.githubusercontent.com/u/9025388?v=4)](https://github.com/shakura "shakura (8 commits)")[![kazip](https://avatars.githubusercontent.com/u/8566378?v=4)](https://github.com/kazip "kazip (1 commits)")

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/shakura-yii2-gearman/health.svg)](https://phpackages.com/packages/shakura-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)
