laylatichy/tempest-debug-bar

Debug bar integration for the Tempest framework

Maintainers

Package info

gitlab.com/laylatichy_projects/tempest-debug-bar

Issues

pkg:composer/laylatichy/tempest-debug-bar

Statistics

Installs: 54

Dependents: 0

Suggesters: 0

Stars: 0

0.0.7 2026-03-19 20:53 UTC

This package is auto-updated.

Last update: 2026-03-19 20:53:35 UTC


README

Debug bar integration for the Tempest framework, powered by PHP Debug Bar.

Zero-config: install the package and it auto-discovers via Tempest's discovery system. Shows query logs, route info, request/response data, and timing — injected into HTML responses during development.

Installation

composer require tempest/debug-bar --dev

That's it. The debug bar is disabled by default.

Configuration

Create a config file in your project (e.g. app/Config/debug-bar.config.php):

<?php

use Tempest\DebugBar\DebugBarConfig;

return new DebugBarConfig(
    enabled: true,
    slowQueryThreshold: 100.0,
);

The package ships with a default config where enabled is false. Override it in your app's config to activate the debug bar.

Config options

OptionTypeDefaultDescription
enabledboolfalseEnable or disable the debug bar
slowQueryThresholdfloat100.0Threshold in ms to flag slow queries

Collectors

CollectorTabData shown
TimeTimelineTotal request duration, application timing
Memory-Peak memory usage (indicator)
PHP Info-PHP version (indicator)
RequestRequestMethod, URL, path, headers, query params, body, cookies, response status and headers
RouteRoute detailsMatched URI, HTTP method, controller::method, middleware stack, route params
QueriesQueriesSQL with bindings, execution time per query, total duration, query count

How it works

  • DebugBarMiddleware runs at Priority::EXCEPTION_HANDLING to wrap the entire request lifecycle
  • Every response gets a phpdebugbar-id header with a unique request ID
  • HTML responses get the debug bar JS/CSS injected before </body>
  • Data is stored to disk via FileStorage and fetched by the JS client from /_debugbar/open
  • AJAX/Inertia navigation updates the debug bar automatically via the AjaxHandler
  • QueryCollector listens to QueryExecuted events via #[EventHandler] (registered as singleton)
  • Assets are served from the php-debugbar vendor directory via /_debugbar/assets/{path}
  • Everything is auto-discovered by Tempest — no manual registration needed
  • When enabled is false, the middleware short-circuits immediately with zero overhead
  • Works with Inertia.js — debug data is fetched via the OpenHandler for both full page loads and XHR navigation

Development

Code Style

composer lint

Static Analysis

composer stan

Tests

composer test

All checks

composer check

License

Use at your own risk. See LICENSE.