PHP Console – a new must-have php debugging tool

PHP Console is a debugging tool for PHP that writes debug info to Chrome debugging console. It was recently updated to the version 3 and has a lot of new nice features now.

There is a similar debugging tool FirePHP that does the same job with Firefox and FireBug.

To use such tools first a browser plugin must be installed. In case of FirePHP there are two plugins: Firebug and FirePHP. And then a php library must be included into a project. After that any server-side activity can be very simple reported to a browser.

When tools like these are needed?

I use them for comprehensive real-time logging and debugging. No breakpoints or  debugger is needed. I can just activate such tool and watch out what is going on on the server side: web server activity, database, cache, session or whatever. Which is especially useful on production systems when normal debugging mode is not available.

Simple loggers using PHP-Console and FirePHP

class ChromeConsoleLogger
{
	function __construct()
	{
		\PhpConsole\Helper::register();
	}

    function log($message) 
    {
        \PC::debug(date("Y-m-d H:i:s").' '.$message);
    }
}

class FirebugLogger
{
    function log($message) 
    {
        \FB::log(date("Y-m-d H:i:s").' '.$message);
    }
}

firephp