Filepath: phork/php/core/CoreDebug.class.php

Phork has a debugging object that can be used to help with development. The debugging object can dispatch to one or more debugging handlers that should be added to the initDebugging() method in the bootstrap. Phork comes with 3 default handlers which can be found in phork/php/ext/debug/.

Each debugging handler must implement the DebugHandler interface which can be found at phork/php/core/interfaces/DebugHander.interface.php.

The debug class is a singleton meaning there can only be one instance of it at a time.

Example (from the bootstrap)

$objDebug = CoreDebug::getInstance();

AppLoader::includeExtension('debug/', 'DebugLog');
$objDebug->addHandler('log', new DebugLog(AppConfig::get('DebugFile')));

AppLoader::includeExtension('debug/', 'DebugDisplay');
$objDebug->addHandler('output', new DebugDisplay());

AppLoader::includeExtension('debug/', 'DebugSession');
$objDebug->addHandler('session', new DebugSession());

CoreDebug::debug('Debug me');

Example Handler

class DebugDisplay implements DebugHandler {
    public function handle($strDebug) {
        echo("{$strDebug}<br />\n");