Courses

Queues in Laravel 12

Other Queueable Classes: Example of Mailables and Event Listeners

You're reading a FREE PREVIEW of a PREMIUM course.
Summary of this lesson:
- Using Event Listeners with ShouldQueue to process notifications
- Using Mailables with ShouldQueue for email sending
- Comparing processing between queued Listeners (one job for multiple emails) vs Mailables (separate job per email)
- Three Laravel classes that can implement ShouldQueue: notifications, event listeners, and mailables

In the last lesson, I showed you the ShouldQueue implementation on the notification email notification. Now let's explore other classes that can use queues in Laravel to further improve your application's performance.


What are Other Queueable Classes?

What other classes can have ShouldQueue in Laravel? There are four results if we go to the Laravel documentation and search for ShouldQueue. One of them is just about queues in general. But three more classes can be queueable. We saw notifications in a previous lesson. Also, event listeners and mails.

Let's try the other two approaches - events with listeners and emails - to implement the same functionality we did previously.


Events and Listeners Class

Laravel fires a Registered event when a user registers and is created. This is a perfect opportunity to implement...

The full lesson is only for Premium Members.
Want to access all 15 lessons of this course? (46 min read)

You also get:

  • 76 courses
  • Premium tutorials
  • Access to repositories
  • Private Discord