We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Asynchronous and real-time

How I can make my functions or requests in the framework work asynchronously, like doing things in real time. what I can do from Phalcon or would have to implement a separate library.

Thanks



98.9k

IMHO PHP has not been designed to work asynchronously, while PHP provides thread safety, there are still several global resources that aren't isolated, this means two functions may try to access the same resource leading to unexpected behaviors.

However, there are efforts to provide multi-tasking and non-blocking I/O in PHP:

pthreads - https://www.php.net/manual/en/intro.pthreads.php (support for threads/multi-tasking) ev - https://www.php.net/manual/en/intro.ev.php (to create non-blocking event loops) pcntl - https://www.php.net/manual/en/book.pcntl.php (to fork PHP processes)

Thank you very much for the info :D ;)



10.8k

use nodeJs