Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Interesting Laravel Packages / Addons

Quite often I will see an interesting add-on/package for Laravel in my feed, but I only have so much time in the world to research and document these things. Hence, here is a list, so I don't forget about them and can quickly find them when I do have some spare time.

1. Laravel Haystack

This is a package that allows you to have a job chain stored in the database.

Example code:

$haystack = Haystack::build()
   ->addJob(new RecordPodcast)
   ->addJob(new ProcessPodcast)
   ->addJob(new PublishPodcast)
   ->then(function () {
      // Haystack completed
   })
   ->catch(function () {
      // Haystack failed
   })
   ->finally(function () {
      // Always run either on success or fail.
   })
   ->paused(function () {
      // Run if the haystack is paused
   })
   ->withMiddleware([
      // Middleware to apply on every job
   ])
   ->withDelay(60) // Add a delay to every job
   ->dispatch();
Last updated: 9th August 2022
First published: 9th August 2022