PHP code example of wizdam / debug-toolbar

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

    

wizdam / debug-toolbar example snippets


use DebugToolbar\DebugToolbar;

$config = olbar->run();

define('WIZDAM_DEBUG', true); // Aktifkan hanya di development!

$middleware = new \DebugToolbar\Middleware\DebugToolbarMiddleware($toolbar);
$middleware->startBuffer();

// ... logika aplikasi Anda berjalan normal ...

$middleware->endBuffer(); // Toolbar otomatis di-inject di akhir HTML

use DebugToolbar\Adapters\AdodbDatabaseAdapter;
use DebugToolbar\Collectors\DatabaseCollector;

$dbAdapter = new AdodbDatabaseAdapter();
$toolbar->addCollector(new DatabaseCollector($dbAdapter));

$app->add(new \DebugToolbar\Middleware\DebugToolbarMiddleware($toolbar));

return [
    'collectors'   => [ /* ... daftar collector class ... */ ],
    'maxHistory'   => 20,
    'historyPath'  => sys_get_temp_dir() . '/wizdam-debug-toolbar/',
    'ignoredRoutes'=> ['/_wizdam-debug-toolbar', '/api/'],
    'toolbarState' => 'minimized',   // 'minimized' atau 'maximized'
    'theme'        => 'auto',        // 'light', 'dark', atau 'auto'
    'maxQueryTime' => 100,           // Highlight query lambat (ms)
];

use DebugToolbar\Interfaces\CollectorInterface;

class CacheCollector implements CollectorInterface
{
    public function getData(): array { /* ... */ }
    public function isEnabled(): bool { /* ... */ }
    public function getBadgeValue(): string|int|null { /* ... */ }
    public function getIcon(): string { /* ... */ }
}

$config['collectors'][] = CacheCollector::class;
$toolbar = new DebugToolbar($config);