PHP is normally used to write synchronous code that is run on a per-request basis within a web server. However, PHP can also be used to create stand-alone, long-running programs. These programs often need to handle many clients or tasks at once without blocking on a single task. Asynchronous operations allow many tasks to be performed cooperatively without blocking, but PHP does not immediately lend itself to asynchronous programming.
Icicle is a library to facilitate writing asynchronous code using synchronous coding techniques to create asynchronous programs written using only PHP. Icicle uses awaitables (promises) and generators to create cooperative coroutines that allow programmers to use synchronous coding techniques to write asynchronous code. This talk will first introduce some of the basic concepts of asynchronous programming. Next, the talk will introduce awaitables as a replacement for callbacks and explain how awaitables can be used with generators to create coroutines. Finally, the talk will look at the packages available for Icicle and explain how they can be used to create a web application server written only in PHP.