⚠️ Warning ⚠️
This article was written 1 year and 5 months ago. The informations it contains may be outdated or no longer relevant.
If you have to make some external API call during a process, but you have no need to wait the response to return result to the user, this tip can help you:
On Symfony, the
kernel.terminate event is launched after the response has been sent to the user.
By keep the response instance and using it in
kernel.terminate event, we don't have to wait the request is completed before render result to user.
If you use Laravel >= 8.x, you can also dispatch event after response is sent :