Skip to content

Chain Laravel jobs without having to glue it to a starting job

Notifications You must be signed in to change notification settings

ephort/laravel-job-chainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Packagist Downloads Code size Build Status

Laravel Job Chainer

JobChainer does chain a variable amount of jobs by adding them with the add() method.

This makes it possible to chain jobs without having to know which job will be the first to be fired.

Normal job chaining

ProcessPodcast::withChain([
    new OptimizePodcast,
    new ReleasePodcast($argA, $argB)
])->dispatch($arg1);

With Job Chainer

$chain = new JobChainer;

$chain->add(ProcessPodcast::class, $arg1);
$chain->add(OptimizePodcast::class);
$chain->add(ReleasePodcast::class, $argA, $argB);

$chain->dispatch();

Why?

This allows us to add jobs to the chain without prior knowledge about which job would be the first. This may come in handy when jobs must be chained, but they are added dynamically to the chain.

Issue

Please open a new issue, if you are experiencing any troubles.