Manage Job Workflows with Venture

Manage Job Workflows with Venture

Venture is a package to help you build and manage complex, asynchronous workflows in your Laravel applications. Here’s an example from the documentation which illustrates a workflow defined when publishing a podcast:

Workflow::new('Publish new podcast')
    ->addJob(new ProcessPodcast($podcast))
    ->addJob(new OptimizePodcast($podcast))
    ->addJob(new PublishPodcastOnTransistorFM($podcast), [

In the above example, publishing the podcast depends on the processing and optimization of job completion.

At the heart of this package is the WorkflowStep trait that you’ll need to add to jobs to use them within a workflow. This trait enables Venture to track a job’s dependencies and other dependent jobs.

Another neat feature is performing an action after a workflow has finished:

Workflow::new('Example Workflow')
    ->addJob(new ExampleJob())
    ->then(function (Workflow $workflow) {
        // This will get called once every job in the workflow has finished.
        // It gets passed the workflow instance.

// You can also use an invokable class with the `then()` method.
class SendNotification
    public function __invokable(Workflow $workflow)
        // Do something with the workflow...

Workflow::new('Example Workflow')
    ->addJob(new ExampleJob())
    ->then(new SendNotification())

Venture also helps you deal with failures in a workflow, failed steps, and things like canceling the workflow. You can learn more about this package, get full installation instructions, and view the source code on GitHub at ksassnowski/venture.

Filed in: News / packages


Join 31,000+ others and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Senior Laravel Developer
EC Pro
Senior Full-Stack Engineer
[REMOTE: USA Only] All Other Applications Will be Rejected Immediately"
Senior Full Stack PHP Developer
Motto Design Studio
Software Engineer
Remote, USA Only
Grow Progress
Lead Backend PHP Developer
Hamburg, Deutschland