PHP code example of adachsoft / debugger

1. Go to this page and download the library: Download adachsoft/debugger 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/ */

    

adachsoft / debugger example snippets


use AdachSoft\Debugger\Debugger;
use AdachSoft\Debugger\Log\LogPrint;
use AdachSoft\Debugger\ParserVarDump;

$debugger = new Debugger(new LogPrint(), new ParserVarDump());

$debugger->varDump(['hello' => 'world']);
$debugger->backTrace();

use AdachSoft\Debugger\DebuggerFactory;

$debugger = DebuggerFactory::create();
$debugger->varDump('hello');



d(['a' => 1, 'b' => [true, null]]);

D::useTypeOnly();
d(['a' => 1, 'b' => [true, null]]);

D::useStandard();
D::dump('standard mode', ['x' => 123]);

D::start();
usleep(100_000);
$elapsed = D::stop('sleep');

D::dump('elapsed', $elapsed);

D::trace();

use AdachSoft\Debugger\Debugger;

Debugger::showAllErrors();

$debugger = D::getInstance();
$debugger->setErrorHandler();

// Any PHP warning/notice/error will be formatted and sent to the configured logger.

use AdachSoft\Debugger\Debugger;
use AdachSoft\Debugger\Log\LogToFile;
use AdachSoft\Debugger\ParserVarDump;

$debugger = new Debugger(
    new LogToFile(fileName: __DIR__ . '/debug.log'),
    new ParserVarDump(),
);

$debugger->varDump('saved to file');