Simple cross-browser Xdebug helper. Session starter and stopper, no add-ons needed.
During a recent browser upgrade I found myself stuck in a bit of a corner. The Firefox add-on I had been using, Xdebug Helper, was discontinued, and the supposed replacement add-on for it didn't work correctly.
Since the functionality of this now-defunct add-on made my life a lot easier (e.g., don't have to manually append/strip '?XDEBUG_SESSION_START=default' in my browser all day long to start/stop debugging sessions) I took it upon myself to keep this functionality and perhaps get rid of yet-one-more-add-on (which pays off when upgrade time comes).
In all their simplicity, here are two bookmarklets you can use to start and stop a Xdebug session in your browser of choice. Note that if you are using a custom proxy key value then you'll need to change the '=default' part in the bookmarklet to '=YourProxyKey
'.
The 'start session' bookmarkSave this bookmark and then all you need to do to start a debugging session (assuming that you have Xdebug setup correctly and a breakpoint set in your code, of course) is to select the bookmark. I chose to put my bookmarks in the Toolbar at the top of window to make it even easier to get to. Also, just for the sake of posterity here is the code for the bookmark.javascript:(function(){location.href=location.href+'?XDEBUG_SESSION_START=default';})();
The 'stop session' bookmarkSave this bookmark and put it next to your 'start session' bookmark. When you're done with your session, simply click this bookmark and viola. Again, here is the code:javascript:(function(){var currentUrl=location.href;var gotoUrl=currentUrl.replace("?XDEBUG_SESSION_START=default","");document.cookie='XDEBUG_SESSION=default;expires=Fri, 3 Aug 2001 20:47:11 UTC;host=none;path=/';location.href=gotoUrl;})();
Categories: DrupalphpxdebugJavaScript