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

ActiveLibrary[Queues &amp; Workers](/categories/queues)

stephenwf/gearman-saga
======================

041PHP

Since Sep 7Pushed 9y ago1 watchersCompare

[ Source](https://github.com/stephenwf/gearman-saga)[ Packagist](https://packagist.org/packages/stephenwf/gearman-saga)[ RSS](/packages/stephenwf-gearman-saga/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Gearman Saga
============

[](#gearman-saga)

#### Usage:

[](#usage)

```
// Create client.
$client = new GearmanSaga\GearmanSaga($gearmanClient);

// Add saga (most likely in a loop)
$client->addSaga(function() {

    $response = yield ['api_request', 'http://...' ];

    $model = yield ['mappings', $response ];

    $ok = yield ['add_to_database', $model ];

    if (!$ok) {
        yield ['rollback', $model];
    }
});

// Run the gearman process.
$client->run();
```

#### Forking into multiple sagas:

[](#forking-into-multiple-sagas)

```
// Create client.
$client = new GearmanSaga\GearmanSaga($gearmanClient);

// Add initial task to get a collection of items.
$client->addTask('get_list_of_somethings', [ 'page' => 0, 'per-page' => 100 ])->then(function(GearmanJob $job) {
    // Grab your data.
    $data = json_decode($job->data());
    // Iterate and add a saga for each.
    foreach ($data->somethings as $something) {

        $client->addSaga(function() use ($something) {

            $model = yield ['mappings', $something ];

            $model = yield ['create_indexes', $something ];

            $ok = yield ['add_to_database', $model ];

            if (!$ok) {
                yield ['rollback', $model];
            }
            else {
                yield ['warm_cache', $model];
            }
        });
    }
    // Run them all in parallel.
    $client->run();
});
// Run the initial task.
$client->run();
```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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/c0e5a9b913301f2fb80dcb626b96d6e5b324522a8201e09f2761729bd1e8ce3b?d=identicon)[stephenwf](/maintainers/stephenwf)

---

Top Contributors

[![stephenwf](https://avatars.githubusercontent.com/u/8266711?v=4)](https://github.com/stephenwf "stephenwf (5 commits)")

### Embed Badge

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

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

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.5M30](/packages/league-geotools)[illuminate/bus

The Illuminate Bus package.

6045.5M508](/packages/illuminate-bus)[uecode/qpush-bundle

Asynchronous processing for Symfony using Push Queues

1672.5M2](/packages/uecode-qpush-bundle)[jayazhao/think-queue-rabbitmq

为 ThinkPHP5.1 队列增加 RabbitMQ 驱动

141.5k](/packages/jayazhao-think-queue-rabbitmq)[mayconbordin/l5-stomp-queue

Stomp Queue Driver for Laravel 5

121.1k](/packages/mayconbordin-l5-stomp-queue)

PHPackages © 2026

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