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

Abandoned → [websightnl/gearman](/?search=websightnl%2Fgearman)Library[Queues &amp; Workers](/categories/queues)

sinergi/gearman
===============

PHP library for dispatching, handling and managing Gearman Workers

v1.1.3(4y ago)77.1k5[1 PRs](https://github.com/websightnl/gearman/pulls)1MITPHPPHP &gt;=5.4.0CI failing

Since Jul 6Pushed 4y ago2 watchersCompare

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

READMEChangelog (6)Dependencies (4)Versions (8)Used By (1)

Gearman
=======

[](#gearman)

[![Build Status](https://camo.githubusercontent.com/b5bd285de73802d833f6e79ad4614b6c4ceefe6ceaf3b8a7f69fc5c61a087cdf/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f77656273696768746e6c2f676561726d616e2f6d61737465722e7376673f7374796c653d666c6174)](https://travis-ci.org/websightnl/gearman)[![Latest Stable Version](https://camo.githubusercontent.com/fe67a8626652983f752e45ab2188886b6a5682b88ff320a10347634b9926930a/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77656273696768746e6c2f676561726d616e2e7376673f7374796c653d666c6174)](https://packagist.org/packages/websightnl/gearman)[![Total Downloads](https://camo.githubusercontent.com/02a4e80e4aab965988b8fbcb79196986a1f01e82beca81d690bba0e35cdf88c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77656273696768746e6c2f676561726d616e2e7376673f7374796c653d666c6174)](https://packagist.org/packages/websightnl/gearman)[![License](https://camo.githubusercontent.com/91a7714d178588063b15454b9b4f9b08a9c9abfdcdf523c17aee28135560fd02/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f77656273696768746e6c2f676561726d616e2e7376673f7374796c653d666c6174)](https://packagist.org/packages/websightnl/gearman)

PHP library for dispatching, handling and managing Gearman Workers

***Todo:** Add support for tasks, only jobs are handled right now.*
***Todo:** Tests are working but could cover more.*

Table Of Content
----------------

[](#table-of-content)

1. [Requirements](#requirements)
2. [Installation](#installation)
3. [Config](#config)
4. [Bootstrap](#bootstrap)
5. [Job example](#job-example)
6. [Dispatcher usage](#dispatcher-usage)
7. [Start workers daemon](#start-workers-daemon)
8. [Usage with Supervisor](#usage-with-supervisor)

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

[](#requirements)

This library uses PHP 5.4+, [PECL Gearman](http://php.net/manual/en/book.gearman.php) and [Gearman 1.0+](http://gearman.org).

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": {
       "websightnl/gearman": "~1.0"
    }
}
```

Config
------

[](#config)

The library uses a Config class to share configuration between classes.

#### Example

[](#example)

```
use Sinergi\Gearman\Config;

$config = (new Config())
    ->addServer('127.0.0.1', 4730)
    ->setUser('apache');
```

#### Example using array

[](#example-using-array)

Alternatively, you can setup the config with an array.

```
use Sinergi\Gearman\Config;

$config = new Config([
    'servers' => ['127.0.0.1:4730', '127.0.0.1:4731'],
    'user' => 'apache'
]);
```

#### Parameters

[](#parameters)

- string **server**
    The Gearman Server (E.G. 127.0.0.1:4730).
- array **servers**
    Pool of Gearman Servers.
- string **bootstrap**
    Path to the bootstrap file.
- string **class**
    Fully qualified name of the bootstrap class, the class needs to implement the `Sinergi\Gearman\BootstrapInterface` interface.
- array **env\_variables**
    Environment variables you want to send to your bootstrap.
- string **user**
    The user under which the Gearman Workers will run (E.G. apache).
- bool **auto\_update**
    Use for ***development only***, automatically updates workers before doing a job or task.
- string **pidFilename**
    Change the filename of the created PID file (defaults to gearmanhandler.pid). The file is always created in the system temp path.
- string **lockFilename**
    Change the filename of the created lock file (defaults to gearmanhandler.lock). The file is always created in the system temp path.
- int **loopTimeout**
    Change the time (in milliseconds) between pinging the Gearman server. Defaults to the low value of 10 milliseconds, for legacy reasons. **Change this value if you experience high load on your Gearman server!**

Bootstrap
---------

[](#bootstrap)

File `/path/to/your/bootstrap.php`

```
use Sinergi\Gearman\BootstrapInterface;
use Sinergi\Gearman\Application;

class MyBootstrap implements BootstrapInterface
{
    public function run(Application $application)
    {
        $application->add(new JobExample());
    }
}
```

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

[](#job-example)

```
use Sinergi\Gearman\JobInterface;
use GearmanJob;

class JobExample implements JobInterface
{
    public function getName()
    {
        return 'JobExample';
    }

    public function execute(GearmanJob $job)
    {
        // Do something
    }
}
```

Dispatcher usage
----------------

[](#dispatcher-usage)

To send tasks and jobs to the Workers, use the Dispatcher like this:

```
use Sinergi\Gearman\Dispatcher;

$dispatcher = new Dispatcher($config);
$dispatcher->execute('JobExample', ['data' => 'value']);
```

Start workers daemon
--------------------

[](#start-workers-daemon)

Starts the Workers as a daemon. You can use something like supervisor to make sure the Workers are always running. You can use the same parameters as in the [config](#config-parameters).

#### Single server

[](#single-server)

```
php vendor/bin/gearman start --bootstrap="/path/to/your/bootstrap.php" --class="MyBootstrap" --server="127.0.0.1:4730"
```

#### Multiple servers

[](#multiple-servers)

```
php vendor/bin/gearman start --bootstrap="/path/to/your/bootstrap.php" --class="MyBootstrap" --servers="127.0.0.1:4730,127.0.0.1:4731"
```

#### List of commands

[](#list-of-commands)

- `start`
- `stop`
- `restart`

Usage with Supervisor
---------------------

[](#usage-with-supervisor)

This is an example of a Supervisor configuration. Add it to your Supervisor configuration file (E.G. /etc/supervisord.conf).

```
[program:mygearman]
command=php /path/to/vendor/bin/gearman start --daemon=false
process_name=%(program_name)s-procnum-%(process_num)s
numprocs=12
autostart=true
autorestart=true

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 51.8% 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.

###  Release Activity

Cadence

Every ~361 days

Recently: every ~397 days

Total

6

Last Release

1797d ago

Major Versions

v0.9.0 → v1.0.02017-02-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/2834bc8d1ea16f434606e47ba6ee32f287dc875737db778ed10532244338c461?d=identicon)[eborned](/maintainers/eborned)

---

Top Contributors

[![gabrielbull](https://avatars.githubusercontent.com/u/671923?v=4)](https://github.com/gabrielbull "gabrielbull (58 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (41 commits)")[![ebuzzz](https://avatars.githubusercontent.com/u/4066914?v=4)](https://github.com/ebuzzz "ebuzzz (5 commits)")[![kevinthrailkill](https://avatars.githubusercontent.com/u/18671739?v=4)](https://github.com/kevinthrailkill "kevinthrailkill (2 commits)")[![gavroche](https://avatars.githubusercontent.com/u/6575485?v=4)](https://github.com/gavroche "gavroche (1 commits)")[![flashover](https://avatars.githubusercontent.com/u/1168068?v=4)](https://github.com/flashover "flashover (1 commits)")[![knigitz](https://avatars.githubusercontent.com/u/3522823?v=4)](https://github.com/knigitz "knigitz (1 commits)")[![filsh](https://avatars.githubusercontent.com/u/6173680?v=4)](https://github.com/filsh "filsh (1 commits)")[![rpungello](https://avatars.githubusercontent.com/u/3287663?v=4)](https://github.com/rpungello "rpungello (1 commits)")[![SerjRamone](https://avatars.githubusercontent.com/u/2033532?v=4)](https://github.com/SerjRamone "SerjRamone (1 commits)")

---

Tags

jobsTasksdaemongearmanworkers

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[dereuromark/cakephp-queue

The Queue plugin for CakePHP provides deferred task execution.

308850.3k14](/packages/dereuromark-cakephp-queue)[mmoreram/gearman-bundle

Adds gearman support to your and Symfony4, Symfony5 project

237395.2k2](/packages/mmoreram-gearman-bundle)[toin0u/geotools

Geo-related tools PHP 7.3+ library

1.4k1.3k](/packages/toin0u-geotools)[cvo-technologies/cakephp-gearman

A gearman plugin for CakePHP 3

1243.5k](/packages/cvo-technologies-cakephp-gearman)[guikingone/scheduler-bundle

A Symfony bundle that allows to schedule and create repetitive tasks

114217.4k](/packages/guikingone-scheduler-bundle)

PHPackages © 2026

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