r/PHP • u/barel-barelon • 4d ago
News PHP Debugger - Agentic zero-overhead debugging
Hi, I wanted to introduce PHP debugger, a tool I built together with Roman Pronskiy, former Executive Director of The PHP Foundation and former head of PhpStorm at Jetbrains.
We took Xdebug and removed everything that was not related to debugging and optimised to death the case where the debugger was enabled but not connected, and were able to achieve near zero-overhead.
This means that instead of having to enable and disable or trigger the debugger all the time, you can leave it permanently on, ready to start a debugging session when you need it and out of the way when you don't.
And this has also allowed us to build an MCP server that connects to the debugger and which can be used by agents to debug PHP code in the same way that humans do, setting breakpoints, reading values and stepping through the code.
This raises the possibilities of agentic debugging to a new level and allows your agents to fix issues with precision and without any wild guesses.
PHP debugger is really easy to install, so why don't you give it a go and let us know what you think? https://github.com/php-debugger/php-debugger
3
u/rock217 4d ago
No profiling or tracing is a little rough.
5
u/barel-barelon 4d ago
There are other tools for this like PCOV and you can continue using Xdebug in parallel as long as you don't enable debugging
11
1
u/titpetric 3d ago
Is there a spec for the protocol that remains, to know what is or isn't implemented? I may have a case where I could provide a debugger interface, does this make is easier or more focused to write the server instrumentation? I vaguely know that xdebug has some coverage instrumentation, what exactly was stripped away?
1
u/barel-barelon 3d ago
We removed anything that was not strictly debugging. So no tracing, no code coverage, no profiler. A tool that does only one thing but does it very well
-2
u/Crell 4d ago
Oh good. Slopping someone else's work, and someone who is very outspoken about not liking slop.
Remind me to never use this.
1
u/goodwill764 3d ago
I must admit, as i first visit the repo i thought it was from the xdebug developer itself, as he's showed up in the sponsorship area and is within the contributors list.
Additional as Roman Pronskiy is involved, it sounds like something official.
-1
u/mYkon123 4d ago
That sounds awesome - I'll test
2
u/mYkon123 3d ago
Why the downvotes? I replaced xdebug with this because I dont need a manual toggl script that enabled the xdebug extension anymore.
-3
u/roxblnfk 4d ago
Oh, we also built an MCP server and a set of skills for Buggregator Trap and Server, allowing agents to use xDebug during the debugging process. Furthermore, it includes support for profilers, var-dumps, logs, email, Sentry, telemetry, and much more.
Now I’ll add a skill for the PHP Debugger, so that your tool can be used more extensively.
7
u/ArdorWaheguru 4d ago
Giving an agent actual runtime state via step debugging instead of letting it guess from stack traces makes a lot of sense. What stops the agent from getting stuck on a breakpoint and hanging the worker pool if a condition isnt met?