vampyrian / monolog-debugbar
Package info
github.com/Vampyrian/diginet-debugbar-log-handler
Language:TypeScript
pkg:composer/vampyrian/monolog-debugbar
Requires
- monolog/monolog: ^3.12
Requires (Dev)
- phpunit/phpunit: ^13.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-19 06:26:37 UTC
README
How to use
How to install
composer require --dev vampyrian/monolog-debugbar
How to instantiate handler
$logger = new Logger('name'); $logger->pushHandler(new DiginetDebugHandler());
The handler ignores records in CLI (console commands, workers), because nothing is output there and
long-running commands would only accumulate records until PHP runs out of memory.
To collect them anyway (e.g. in tests), pass collectInCli: true:
$logger->pushHandler(new DiginetDebugHandler(collectInCli: true));
How to log query
$logger->info('pdo::execute', [ 'query' => 'SELECT * FROM `user_emails` WHERE `user_id` = 991', 'duration' => 0.0002901554107666, 'memory' => 0.0027084350585938, 'count' => 1, 'query_md5' => 'aetjhsryjmsrynsryj', 'links' => [ [ 'name' => '/Erp/Controller/Home/EmailGateway', 'link' => 'phpstorm://open?file=/home/zilvinas/dev/erp/src/Erp/Controller/Home/HomeController.php&line=50', ], [ 'name' => '/Erp/Controller/Home/UserGateway', 'link' => 'phpstorm://open?file=/home/zilvinas/dev/erp/src/Erp/Controller/UserController.php&line=2050', ], ] ]);
How to log controller method
$logger->info('controller', [ 'link' => 'phpstorm://open?file=/Erp/Controller/Home/HomeController.php&line=50', "name": "/Erp/Controller/Home/HomeController", ]);
Output in browser (data + compiled public/js/debugbar.js in one module)
<script type="module"> const data = [ { type: 'pdo::execute', query: 'SELECT * FROM `user_emails` WHERE `user_id` = 991', duration: 0.0002901554107666, memory: 0.0027084350585938, count: 1, query_md5: 'aetjhsryjmsrynsryj', links: [ { name: '/Erp/Controller/Home/EmailGateway', link: 'phpstorm://open?file=/home/zilvinas/dev/erp/src/Erp/Controller/Home/HomeController.php&line=50', }, { name: '/Erp/Controller/Home/UserGateway', link: 'phpstorm://open?file=/home/zilvinas/dev/erp/src/Erp/Controller/UserController.php&line=2050', } ] { type: 'controller', link: 'phpstorm://open?file=/Erp/Controller/Home/HomeController.php&line=50', name: "/Erp/Controller/Home/HomeController", } ]; (function(){ /* public/js/debugbar.js */ })(); </script>
How to develop frontend
The debugbar is a React + TypeScript + Tailwind app built with Vite.
Project structure
resources/js/– debugbar source codemain.tsx– entry point; reads the globaldataarray printed by the PHP handler and mounts the app inside a Shadow DOMApp.tsx– root componentcomponents/– UI componentshelpers/– shared helpers (localStorage, link replacer, ...)types.ts– record typesapp.css– Tailwind styles (inlined into the bundle)
playground/– local development environmentindex.html– a fake host page that imitates the PHP handler outputdata.json– sample log records passed to the debugbar; edit it to test different data
Install dependencies
npm install
Run development environment
npm run playground
Starts the Vite dev server with hot reload and opens playground/index.html in the browser.
Changes in resources/js/ and playground/data.json are picked up automatically.
Other commands
npm run typecheck # TypeScript type check npm run build # type check + build public/js/debugbar.js npm run dev # rebuild public/js/debugbar.js on every change
How to prepare new release
Requires git, php, installed composer/npm dependencies and an authenticated GitHub CLI (gh auth login).
- Run tests (TypeScript type check + PHPUnit):
composer test - Build the frontend bundle.
public/js/debugbar.jsis committed to the repository, so the release must contain a fresh build:npm run build
- Commit the built
public/js/debugbar.js(and any other changes) and push tomain. The release script requires a clean working tree onmainthat is in sync withorigin/main. - Create the release:
bin/release create patch
This reads the current version fromcomposer.json, bumps it, runs tests again, commits the version change, creates and pushes avX.Y.Ztag and publishes a GitHub release with generated notes.
Other release options:
bin/release create minor # 0.1.1 -> 0.2.0 bin/release create major # 0.2.0 -> 1.0.0 bin/release list # show GitHub releases bin/release delete 0.2.0-beta # delete release + tag