PHP code example of dotkernel / dot-debugbar

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

    

dotkernel / dot-debugbar example snippets


$app->pipe(\Dot\DebugBar\Middleware\DebugBarMiddleware::class);

\Dot\DebugBar\ConfigProvider::class

\Dot\DebugBar\Extension\DebugBarExtension::class

$debugBar = $container->get(\Dot\DebugBar\DebugBar::class);

$this->debugBar->addMessage(1);
$this->debugBar->addMessage(true);
$this->debugBar->addMessage('foo');
$this->debugBar->addMessage(['foo']);
$this->debugBar->addMessage(new \stdClass());

$exception = new \Exception('something went wrong');
$this->debugBar->addMessage($exception, 'error');
$this->debugBar->addMessage($exception->getMessage(), 'error');
$this->debugBar->addMessage('some warning', 'warning');
$this->debugBar->addMessage('custom message', 'custom');

$this->debugBar->measure('long operation', function () {
    // your code here
});

$this->debugBar->startTimer('long operation', 'measuring long operation');
// your code here
$this->debugBar->stopTimer('long operation');

$this->debugBar->stackData();