Asynchronous PHP

PHP code is blocking, meaning that one block of code will not run until the block prior to it has finished. It wasn't built with asynchronous execution in mind like Go, NodeJs, and other languages.

That's a very simple implementation but I wanted to show you how easily it can be done. For more advanced use cases, Spatie has built a package called spatie/async which runs and manages several PHP processes to run your code in an asynchronous fashion.


Follow this article details

Comments