PHPackages                             datashaman/job-chain - 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. datashaman/job-chain

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

datashaman/job-chain
====================

Chain jobs together with cache.

042[1 PRs](https://github.com/datashaman/job-chain/pulls)

Since Jul 9Compare

[ Source](https://github.com/datashaman/job-chain)[ Packagist](https://packagist.org/packages/datashaman/job-chain)[ RSS](/packages/datashaman-job-chain/feed)WikiDiscussions Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

job-chain
=========

[](#job-chain)

Job chains powered by cache for Laravel.

installation
------------

[](#installation)

```
composer require datashaman/job-chain

```

instrumentation
---------------

[](#instrumentation)

```
use Datashaman\JobChain\HasJobChain;

class MyJob
{
    use HasJobChain;

    public handle()
    {
        // do things
        $value = 'my job has run';

        $this->done($value);
    }
}

```

configuration
-------------

[](#configuration)

```
return [
    /**
     * Job chain loader will search through these paths for chain files.
     */
    'paths' => [
        base_path('chains'),
    ],

    /**
     * Cache store use for holding chain state.
     */
    'cache' => env('JOB_CHAIN_CACHE', env('CACHE_DRIVER', 'file')),

    /**
     * Cache item lifetime. This must be longer than the total expected
     * run time for any chain.
     *
     * This can overridden per chain.
     */
    'lifetime' = env('JOB_CHAIN_LIFETIME', 60 * 60 * 24),
];

```

usage
-----

[](#usage)

Given this file `chains/chain1.yml`:

```
done: jobThree

lifetime: 86400

jobs:
  jobOne:
    type: JobOne
  jobTwo:
    type: JobTwo
    params:
      documents: !job jobOne
  jobThree:
    type: JobThree
    params:
      documents: !job jobTwo

```

And these three test job class:

```
use Datashaman\JobChain\HasJobChain;

class JobOne
{
    use HasJobChain;

    public function handle()
    {
        $this->done('JobOne has run');
    }
}

class JobTwo
{
    use HasJobChain;

    public function handle()
    {
        $this->done('JobTwo has run');
    }
}

class JobThree
{
    use HasJobChain;

    public function handle()
    {
        $this->done('JobThree has run');
    }
}

```

When you run this code:

```
use JobChain;

Event::listen(function (JobChainDone $event) {
    logger()->info('Job chain done', [
        'jobChain' => $event->jobChain,
        'value' => $event->value,
    ]);
});

JobChain::run('chain1');

```

Execution will flow sequentially through `JobOne`, `JobTwo` and `JobThree` because of the dependency graph denoted by using a custom type of `!job` in the YAML definition.

The event listener should receive a value of `JobThree has run` which is the value the `done` job has submitted.

If the chain does not define a `done` job, it is assumed to be the last job in the definition.

Test build.

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 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/48372fbab9c5059c6d5773bb3d42dff0382443ceb65d008fc219ad38a383eafd?d=identicon)[datashaman](/maintainers/datashaman)

---

Top Contributors

[![datashaman](https://avatars.githubusercontent.com/u/59514?v=4)](https://github.com/datashaman "datashaman (21 commits)")

### Embed Badge

![Health badge](/badges/datashaman-job-chain/health.svg)

```
[![Health](https://phpackages.com/badges/datashaman-job-chain/health.svg)](https://phpackages.com/packages/datashaman-job-chain)
```

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.6M31](/packages/league-geotools)[illuminate/bus

The Illuminate Bus package.

6046.3M542](/packages/illuminate-bus)[uecode/qpush-bundle

Asynchronous processing for Symfony using Push Queues

1672.5M2](/packages/uecode-qpush-bundle)[belvg/module-sqs

N/A

1544.6k](/packages/belvg-module-sqs)[bsidev/bitrix-queue

Queues for Bitrix CMS

232.8k](/packages/bsidev-bitrix-queue)[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)
