A great deal of PHP IO syntax is blocking in nature. It holds that - by extension - many PHP codebases do not exhibit asynchronous behavior akin to that of languages like JavaScript. Blocking IO does not solve a lot of the problems modern applications - computationally intensive in nature - demand that programmers do. Enter ReactPHP, a PHP-userland affable suite of technologies - complete with an event loop, a NodeJS-akin server, and Promises.

ReactPHP, through its many offshoot syntaxes, offers the potencies of non-blocking IO to the PHP developers who use it. The ethos of asynchronous, non-blocking IO, is minimizing CPU idleness. ReactPHP is primarily an implementation of the Reactor pattern - an apt model for porting async-first code to PHP. The said pattern allows for an event-loop, a demultiplexer to run within a single PHP thread and effectively leverage a CPU to run multiple actions (tasks) in near-overlapped sequences.

The talk titled Asynchronous Programming in PHP with ReactPHP is a multi-segment session. The first part - a discussion on asynchrony - is an explanation of non-blocking IO and its importance. The second part - an introduction to ReactPHP - is a description of ReactPHP's subtleties and the event loop. The third and fourth parts - the respective focus points being usage and application of ReactPHP - conclude the session.

Comments

Comments are closed.