I'm a bit spoiled on ruby and am used to using the amazing pry
facilities for apps. I'll lock an app down to 1 thread and then let pry pop open in the httpd console and then be able to get to the bottom of a lot of issues, however I am not finding anything quite like this available in PHP. Is there a similar or accepted solution that works like this for PHP for debugging and tracing out data structures, etc. during execution?
I know exactly what you mean. I missed Pry after moving to PHP as well. So far PsySH looks like the best REPL for PHP that is the most like Pry. It has reflection, so you can use commands like ls
to evaluate the variables, constants, classes, etc. It has a help command, similar to Pry's show-doc
that allows you to read documentation on functions or object properties. You can even view the source of any object, just like Pry's show-source
command. Also debugging:
"PsySH can be used as an interactive debugger, much like JavaScript's debugger statement, saving you from endless var_dump() and die() iterations. Just drop this line in where you'd like to have a breakpoint:
\Psy\Shell::debug(get_defined_vars());"
Boris is also another good REPL for PHP that is similar to Pry.
Yeah. Called dephpugger
https://github.com/tacnoman/dephpugger
You start the server in terminal and debugger too. The commands are similar, n to next, c to continue, etc...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With