Don't understand why you call idle for each user?
How do call it ? With Laravel Event/Listener?
Do you know this package https://beyondco.de/docs/laravel-mailbox ?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm using the php-imap package to allow the users of my app to connect to their mailbox. I want to listen to incoming emails.
I call the idle() function from php-imap - link to idle() docs - for each user (to listen for incoming emails) and I want to stop the execution of it when, for example, a user deletes its account.
The problem is that the idle() function never finishes executing, because of that my code never finishes running and gets stuck.
Is there a way to run that idle() function in a separate PHP process so that the Laravel code doesn't get stuck, but with the possibility of dispatching en event within the idle() function (when a new email is received)?
I found a solution using ReactPHP
Here it is: https://github.com/Webklex/php-imap/issues/206
Please or to participate in this conversation.