In a new tutorial to the Scotch.io site they take a look at Laravel's queuing functionality and explain why they think it's awesome for handling asynchronous operations in your applications.
Otwell took his time to build Laravel and it's documentation and one of the major features that really amaze me is what we are going to experiment with, Queues.Queues in Laravel are used to make a smooth sailing application cycle by stacking heavy tasks to be handled as jobs and dispatching these jobs when it is asked to or when it does not disrupt the user's experience.
They then show how to use the queuing system to send out emails asynchronously rather than waiting for them to send via the application and making the user wait. First they show how to send them a bit more manually, making use of the Mailtrap service for testing the emails being sent. They set up a basic controller with a "send" endpoint that uses the Mail
functionality to send a simple HTML email. Next they show how to refactor this into something that uses queues to handle the email sending via a SendWelcomeEmail
job. He talks about performance differences between the queued and non-queued version and links to a demo repository if you'd like to see it all working together.