PHP code example of iak / dispatch-group

1. Go to this page and download the library: Download iak/dispatch-group library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

iak / dispatch-group example snippets


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

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