Oh boy, I sure went down the rabbit hole on this one.
I needed an event loop for another project I was working on. My problem was that you cannot easily pipe a websocket connection to the ReactPHP framework, so I needed a way to set up an event loop based on my own custom input.
So, if you happen to be shopping around for a simple event-loop library, you might consider this one.
There is a simple example in the repository. Here you go. Its even on Packagist.