PHP code example of fastd / debug

1. Go to this page and download the library: Download fastd/debug library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fastd / debug example snippets


use FastD\Debug\Debug;
Debug::enable();
trigger_error('demo');

$logger = new \Monolog\Logger('test');
$stream = new \Monolog\Handler\StreamHandler(__DIR__ . '/test.log');
$stream->setFormatter(new Monolog\Formatter\LineFormatter("[%datetime%] >> %level_name%: >> %message% >> %context% >> %extra%\n"));
$logger->pushHandler($stream);

$debug = \FastD\Debug\Debug::enable(false, $logger);

throw new \Exception('test');

\FastD\Debug\Debug::enable();

class PageException extends \FastD\Debug\Exceptions\HttpException
{
    /**
     * Returns response content.
     *
     * @return string
     */
    public function getContent()
    {
        return file_get_contents(__DIR__ . '/demo.html');
    }
}

throw new PageException('custom');