PHPackages                             iak/dispatch-group - 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. iak/dispatch-group

AbandonedArchivedLibrary

iak/dispatch-group
==================

Run code when a group of queued jobs has completed, successfully or not.

v0.0.1(6y ago)58MITPHPPHP ^7.4

Since May 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/iaK/dispatch-group)[ Packagist](https://packagist.org/packages/iak/dispatch-group)[ Docs](https://github.com/iak/dispatch-group)[ GitHub Sponsors](https://github.com/iaK)[ RSS](/packages/iak-dispatch-group/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

\[Warning\] deprecated package!
===============================

[](#warning-deprecated-package)

Since this functionality now exists in [Laravels core](https://laravel.com/docs/8.x/queues#job-batching), this package is no longer needed and therefore not maintained.

Laravel dispatch-group
----------------------

[](#laravel-dispatch-group)

Run code when a group of queued jobs has completed, successfully or not.

Inspired by javascript's Promise.all(), this package provides a similar API to run code when your jobs have completed.

Example:

```
dispatch_group([new FirstJob(), new SecondJob()])
    ->then(fn () => User::admin()->notifySuccess())
    ->catch(fn ($failedJobs) => User::admin()->notifyFailure($failedJobs))
    ->finally(fn () => User::admin()->notifyCompleted());
```

### How it works

[](#how-it-works)

Along with the jobs you pass into the function, another job is queued, which monitors the jobs and registers when they have completed and if they ran successfully.

This means that the monitoring job will take up one worker, so this package only makes sense if you have 3 or more workers or plan to run the monitoring job synchronously.

### Installation

[](#installation)

Simply install it using composer:

```
composer require iak/dispatch-group
```

That's all!

### Compability

[](#compability)

This package works both with and without Laravel horizon, but only supports the redis driver.

Tested with Laravel 7 and php 7.2

### Helper functions

[](#helper-functions)

Along with the dispatch\_group() function mentioned above, theres also a dispatch\_group\_now() function that run the monitoring job in the current process.

### API

[](#api)

The dispatch\_group() and dispatch\_group\_now() functions returns a job, and therefore has the same API any other job (onQueue(), delay(), chain() and so on).

In addition to those, these methods are also available:

#### then(Closure $callback)

[](#thenclosure-callback)

Function to call when all jobs completed *successfully*.

#### catch(Closure $callback)

[](#catchclosure-callback)

Function to call if one or more jobs fails. Gets the failed jobs as a parameter (array).

example:

```
dispatch_group([new FirstJob(), new SecondJob()])
    ->catch(fn ($failedJobs) => /* Do something with the failed jobs */);
```

#### finally(Closure $callback)

[](#finallyclosure-callback)

Function to call when all jobs completed, successfully or not.

#### iterate(Closure $callable)

[](#iterateclosure-callable)

Function that gets called every time the monitoring job check if all jobs has completed (1 second interval).

#### dispatch()

[](#dispatch)

Dispatch the jobs. This gets called automatically in the jobs \_\_destruct method, but if you need to make sure it runs straight away - call dispatch().

#### groupQueue(String $queue)

[](#groupqueuestring-queue)

Same as onQueue(), except this applied to the jobs passed in, while onQueue() applies to the job monitoring the jobs.

### Tests

[](#tests)

To run the tests, run

```
composer test
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2200d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f8e167637ace3c09cf95c25f7d826a2352f06a7bd47d512f2ee5ed484840a27?d=identicon)[iaK](/maintainers/iaK)

---

Top Contributors

[![iaK](https://avatars.githubusercontent.com/u/2571644?v=4)](https://github.com/iaK "iaK (22 commits)")

---

Tags

laraveljobsdispatchqueuesqueued jobsiaKdispatch-group

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/iak-dispatch-group/health.svg)

```
[![Health](https://phpackages.com/badges/iak-dispatch-group/health.svg)](https://phpackages.com/packages/iak-dispatch-group)
```

###  Alternatives

[timokoerber/laravel-one-time-operations

Run operations once after deployment - just like you do it with migrations!

6481.7M11](/packages/timokoerber-laravel-one-time-operations)[moox/jobs

Manage Job Queues, Failed Jobs and Batches in Filament.

6421.8k](/packages/moox-jobs)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

3786.5k](/packages/harris21-laravel-fuse)[hpwebdeveloper/laravel-failed-jobs

UI for Laravel failed jobs.

183.1k](/packages/hpwebdeveloper-laravel-failed-jobs)

PHPackages © 2026

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