In this article, we’re going to explore the Queue API in the Laravel web framework. It allows you to defer resource-intensive tasks during script execution to enhance the overall end user experience. After introducing the basic terminology, I’ll demonstrate it by implementing a real-world example.
The article starts by talking about some of the advantages of using queues to help with reducing page load times and improving the overall performance/quality of your site’s user experience. It then starts in on the Laravel-specific pieces of the queuing puzzle including the queue drivers, connection types and the queues themselves. Next they move on to the code, showing how to create a simple first job that will manipulate the images a user uploads. The post includes the code to create the "jobs" table, build the "Images" model and the "ProcessImageThumbnails" job that will build the smaller thumbnail images from larger ones. Finally they create the controller and views for the upload handling, show how to delegate it to the job for the image processing and run the queue processor do to the actual work.