Debug your XMLHTTPRequest.


We switched to Laravel and Laravel Debugbar by @barryvdh which uses PHP Debug Bar under the hood.


A method to send debugging information alongside your XMLHTTPRequest.

Inspired by FirePHP.



if (isset($_SERVER['HTTP_DEBUGR'])) { // Only send headers when DebugR is enabled
	// Send a message alongside the request.
	header('DebugR: '.base64_encode('Hello DebugR'));
	// Append a unique label to send multiple messages.
	header('DebugR-my-first-label: '.base64_encode('Moarr information'));
	// Send another message with the same label
	header('DebugR-my-first-label.2: '.base64_encode(''));

	// For very large messages, you should send the message in chunks (Detected by the "..chunk0", ".chunk1", etc suffix).
	// Restriction on the maximum size for a single HTTP header (Max 4Kib for nginx 8KiB for Apache)
	$chunks = str_split(base64_encode($largeString), 4000); //
	foreach ($chunks as $index => $chunk) {
		header('DebugR-largeString.chunk'.$index.': '.$chunk);


Install the DebugR - Google Chrome extension or include debugr.js which monkey-patches the XMLHttpRequest object.

Both the Chrome extension and the debugr.js use window.postMessage to push debugr information to the page.

window.addEventListener('message', function (e) {
	if ( && === 'my-first-label') {) {
}, false);
document.documentElement.setAttribute('data-debugR'); // Signal the extension that the eventlistener is active.