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

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

apollo/yii2-gearman
===================

Gearman handler for PHP (fork)

02862PHP

Since May 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/vov4ik08/yii2-gearman)[ Packagist](https://packagist.org/packages/apollo/yii2-gearman)[ RSS](/packages/apollo-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) and [this](https://github.com/shakura/yii2-gearman)The goal of the project is opportunity of starting multiple worker processes on one machine. Work only as process(fork). In config you can set count of nodes, look 'Configuration'

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": {
       "apollo/yii2-gearman": "dev-master"
    }
}
```

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

[](#configuration)

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

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

[](#job-example)

```
namespace common\jobs;

use apollo\yii2-gearman\JobBase;

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

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

[](#manage-workers)

```
yii gearman/start  // start the worker
yii gearman/restart  // restart worker
yii gearman/stop // 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

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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://avatars.githubusercontent.com/u/2761022?v=4)[Vladimir Boyko](/maintainers/vov4ik08)[@vov4ik08](https://github.com/vov4ik08)

---

Top Contributors

[![shakura](https://avatars.githubusercontent.com/u/9025388?v=4)](https://github.com/shakura "shakura (7 commits)")[![vov4ik08](https://avatars.githubusercontent.com/u/2761022?v=4)](https://github.com/vov4ik08 "vov4ik08 (7 commits)")

### Embed Badge

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

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

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[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

2228.8M171](/packages/react-async)[react/promise-stream

The missing link between Promise-land and Stream-land for ReactPHP

11512.9M45](/packages/react-promise-stream)[illuminate/bus

The Illuminate Bus package.

6043.8M409](/packages/illuminate-bus)

PHPackages © 2026

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