Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Interactive PHP Debugging with PsySH
Sep 30, 2014 @ 17:53:30

The SitePoint PHP blog has a new tutorial posted by i>Miguel Ibarra Romero showing how to use the PsySH tool to do some interactive debugging of your PHP applications via both the command line and a web frontend.

It’s 1:00 a.m., the deadline for your web application’s delivery is in 8 hours… and it’s not working. As you try to figure out what’s going on, you fill your code with var_dump() and die() everywhere to see where the bug is. [...] Is this situation familiar to you? PsySH to the rescue. PsySH is a Read-Eval-Print Loop (or REPL). You may have used a REPL before via your browser’s javascript console. If you have, you know that it possesses a lot of power and can be useful while debugging your JS code.

He walks you through the install via Composer and some of the basic commands and syntax for executing PHP code inside its shell. Command line testing is good, but debugging full applications is a bit more difficult. He shows how to integrate the tool into a sample application that calls PsySH via a "debug" call and output via a set of "window" objects. He also includes a bit close to the end about debugging with unit tests, executing them from inside the shell as well.

tagged: interactive debugging psysh repl unittest commandline web

Link: http://www.sitepoint.com/interactive-php-debugging-psysh/


Trending Topics: