PHP Logo

Playing With ReactPHP

19th November 2012 - 14 minutes read time

I recently saw an implementation of a Twitter wall that used node.js to run searches on Twitter and post the results on a webpage. I had been wanting to create something using ReactPHP so I thought this was a good opportunity to have a go. ReactPHP, if you haven't heard of it, is an event-driven, non-blocking I/O that is essentially the PHP equivalent of node.js. The major difference is that ReactPHP is written in pure PHP with no extra components, whereas node.js is a collection of different programs, interfaces and languages. As a first attempt I wanted to create something simple so it needed to use simple JavaScript to load in the latest tweets for a given hashtag from a ReactPHP server. I have to warn that this is a simplistic implementation of ReactPHP, but it shows the basics of how to get started.