How defer() in Laravel 11 Made Our API Responses 3x Faster Without Touching a Single Queue

php dev.to

TL;DR: Laravel 11 introduced defer() which runs code after the HTTP response is sent to the user. No queues, no job classes, no workers. Just wrap your fire-and-forget logic in defer() and your API becomes instantly faster. I spent two days last year trying to figure out why our order API endpoint was taking 1.2 seconds to respond. The order itself was being created in about 80ms. So where was the rest of the time going? Turns out we were sending a confirmation email, tracking an analytics

Read Full Tutorial open_in_new
arrow_back Back to Tutorials