memran / marwa-debugbar
A lightweight, framework-agnostic PHP debug bar with profiling capabilities
v2.0.0
2025-08-20 14:25 UTC
Requires
- php: ^7.4 || ^8.0
- ext-json: *
- memran/marwa-support: ^1.0
Requires (Dev)
- memran/marwa-logger: ^1.0
- mockery/mockery: ^1.4
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.6
- symfony/var-dumper: ^5.3
Suggests
- monolog/monolog: For advanced logging integration
- psr/log: To integrate with PSR-3 compatible loggers
- symfony/var-dumper: For enhanced variable dumping capabilities
This package is auto-updated.
Last update: 2025-08-21 14:02:58 UTC
README
A framework-agnostic, lightweight, floating Debug Bar for PHP 8.1+.
Built for clarity, speed, and extensibility with lazy collectors.
✨ Features
- Lazy Collector System — register by class, instantiated only when rendering
- Server-side HTML tabs — each collector renders its own HTML
- Timeline — request marks with deltas + total time
- VarDumper — pretty dumps captured into a tab
- Logs — PSR-3 style logs with context and badges
- DB Queries — SQL, bindings, connection, timings
- Session — status, metadata, and data
- History — browse JSON snapshots from disk (and/or via endpoint)
- Modern floating UI — toggle with a button or
~
📦 Install
composer require memran/marwa-debugbar --dev ## Installation ```bash composer require marwa/debugbar --dev
Quick Start
use Marwa\DebugBar\DebugBar; use Marwa\DebugBar\Renderer; use Marwa\DebugBar\Collectors\{ TimelineCollector, VarDumperCollector, LogCollector, DbQueryCollector, SessionCollector }; $bar = new DebugBar(($_ENV['DEBUGBAR_ENABLED'] ?? '0') === '1'); // Lazy collector registration (no instantiation yet) $bar->collectors()->register(TimelineCollector::class); $bar->collectors()->register(VarDumperCollector::class); $bar->collectors()->register(LogCollector::class); $bar->collectors()->register(DbQueryCollector::class); $bar->collectors()->register(SessionCollector::class); // Or auto-discover all collectors in the namespace/folder // $bar->collectors()->autoDiscover(__DIR__.'/src/Collectors', 'Marwa\\DebugBar\\Collectors'); // During your request lifecycle: $bar->mark('bootstrap'); // ...do work... $bar->mark('controller'); // ...do work... $bar->mark('view'); // Add logs/queries/dumps from your app: $bar->log('info', 'DebugBar mounted', ['userId' => 42]); $bar->addQuery('SELECT * FROM users WHERE id=?', [42], 12.34, 'mysql'); // Symfony VarDumper: will render on the Dumps tab dump(['id'=>42, 'name'=>'Ada']); // Inject into HTML (at the end of your response): echo (new Renderer($bar))->render();