All examples By author By category About

fabiovalse

Server Sent Events based PHP Debugger

This PHP debugger uses the HTML5 Server Sent Events (SSE) technology. SSE allows to send messages from the server side, where the PHP is executed, to the client side. Thus it is possible to include send_event() operation inside PHP scripts.

Moreover on the client side the index.js script can handle in different ways the messages sent by the PHP script (sender.php). In this example three displaying method are considered:

  1. console.log;
  2. alert;
  3. text on a html div tag.

Using this approach it is possible to track and debug the execution of the PHP script just by looking at the log console of your browser.