Enable/Disable XDebug Debugging/Profiling
XDebug can be very useful for debugging and profiling PHP applications, however many IDEs/editors do not have built-in support for enabling it.
Personally, I use XDebug in combination with MacGDBp for debugging and Webgrind for Profiling.
Usage
Just create bookmarks with each of the the code snippets below as the URL, and debugging/profiling is just a click away.
Enable Profiling
javascript:(function() {
var search = document.location.search,
args = (search ? search.replace('XDEBUG_PROFILE', '')
.replace(/[&]+/g, '&')
.replace(/&$/,'')
.substring(1)
.split('&')
: []
);
args.push('XDEBUG_PROFILE');
document.location =
document.location.protocol + '//' +
document.location.host +
document.location.pathname +
'?' +
args.join('&').replace(/^&|&$/,'');
})();
Enable Debugging
javascript:(function() {
var search = document.location.search,
args = (search ? search.replace('XDEBUG_SESSION_START=1', '')
.replace('XDEBUG_SESSION_STOP=1', '')
.replace(/[&]+/g, '&')
.replace(/&$/,'')
.substring(1)
.split('&')
: []
);
args.push('XDEBUG_SESSION_START=1');
document.location =
document.location.protocol + '//' +
document.location.host +
document.location.pathname +
'?' +
args.join('&').replace(/^&|&$/,'');
})();
Disable Debugging
javascript:(function() {
var search = document.location.search,
args = (search ? search.replace('XDEBUG_SESSION_START=1', '')
.replace('XDEBUG_SESSION_STOP=1', '')
.replace(/[&]+/g, '&')
.replace(/&$/,'')
.substring(1)
.split('&')
: []
);
args.push('XDEBUG_SESSION_STOP=1');
document.location =
document.location.protocol + '//' +
document.location.host +
document.location.pathname +
'?' +
args.join('&').replace(/^&|&$/,'');
})();
