Download the PHP package iak/dispatch-group without Composer

On this page you can find all versions of the php package iak/dispatch-group. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dispatch-group

[Warning] deprecated package!

Since this functionality now exists in Laravels core, this package is no longer needed and therefore not maintained.

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:

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

Simply install it using composer:

That's all!

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

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

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)

Function to call when all jobs completed successfully.

catch(Closure $callback)

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

example:

finally(Closure $callback)

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

iterate(Closure $callable)

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

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)

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

Tests

To run the tests, run


All versions of dispatch-group with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4
opis/closure Version ^3.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package iak/dispatch-group contains the following files

Loading the files please wait ....