Debugger and toolbar for Yii3 applications
Shared Debug Core UI, scoped CSS, light/dark mode, and application-registered extension panels
Warning
Development only. Never enable the debugger in production. Keep access restricted to trusted development IPs and
install production dependencies with composer install --no-dev.
Requires PHP 8.3 or newer and a Yii 3 application using Yii Config Plugin. Version 0.1.0 is available as a stable Composer release. The debugger is development-only runtime tooling, so keep it in the development dependency set:
composer require --dev "yii3/debug:^0.1"The ^0.1 constraint selects stable releases from 0.1.0 up to, but not including, 0.2.0. A stable Composer version
does not promise API compatibility with future 0.x minor lines.
The application must already provide the yiisoft/router-implementation and yiisoft/db-implementation virtual
packages. Keep its existing router and database driver; if either provider is absent, choose one that matches the
application before retrying installation.
Run the application with APP_ENV=dev. The debugger also accepts debug and test; it stays disabled when the runtime
environment is missing, unknown, or production. Setting the runner's configuration environment alone is not enough.
Rebuild the merged configuration after installing or updating the package:
composer yii-config-rebuildInstallation publishes configuration, but the application still owns its aggregate configuration groups, logger, and
middleware list. In an application built from the yiisoft/app template, two definitions connect the debugger. Spread
the merged middleware list before the application middleware in config/web/di/application.php:
use Yiisoft\ErrorHandler\Middleware\ErrorCatcher;
use Yiisoft\Router\Middleware\Router;
'withMiddlewares()' => [[
// DebugRouteMiddleware serves the debugger pages under /debug and answers 403 outside allowedIPs.
// RequestCaptureMiddleware captures every other request and injects the toolbar into HTML responses.
...($params['yiisoft/middleware-dispatcher']['middlewares'] ?? []),
ErrorCatcher::class,
Router::class,
]],Build the logger from the merged targets in config/common/di/logger.php:
use Psr\Log\LoggerInterface;
use Yiisoft\Definitions\ReferencesArray;
use Yiisoft\Log\{Logger, StreamTarget};
LoggerInterface::class => [
'class' => Logger::class,
'__construct()' => [
// The package merges its `debug` target into this list. A hardcoded list leaves the Logs panel empty.
'targets' => ReferencesArray::from(
array_values($params['yiisoft/log']['targets'] ?? [StreamTarget::class]),
),
],
],Every runner must also load the package groups, including di-web and events-web. The
Getting started guide covers the groups and the checks that
prove a working integration. Installing the package or seeing it in the merge plan alone does not prove that the
debugger can resolve from the container or capture a request.
Under a URL subfolder such as /api, the debugger follows the application base URL. Keep routePrefix at /debug and
open /api/debug. Tell the debugger the base in one of two ways:
use Yiisoft\ErrorHandler\Middleware\ErrorCatcher;
use Yiisoft\Router\Middleware\Router;
use Yiisoft\Yii\Middleware\Subfolder;
// Option 1, config/web/di/application.php: an auto-detecting Subfolder BEFORE the debugger middleware list.
'withMiddlewares()' => [[
Subfolder::class,
...($params['yiisoft/middleware-dispatcher']['middlewares'] ?? []),
ErrorCatcher::class,
Router::class,
]],
// Option 2, config/common/aliases.php: no Subfolder, for example with every route declared under the prefix.
'@baseUrl' => '/api',Important
A Subfolder with an explicit prefix does not set @baseUrl, and one placed after the debugger middleware list
reaches the debugger too late. Set '@baseUrl' => '/api' as well in both cases; otherwise the debugger pages are not
served under the subfolder or request their assets from the host root. See
Serving the application under a subfolder.
Open an application page, expand the toolbar at the bottom, and select a panel chip to inspect the request. Use the Yii
chip for Configuration and the PHP chip for PHP info. Switch between light and dark themes from the toolbar, and press
Escape to close the drawer.
Open /debug to browse retained requests. Select two captures in History to compare request metrics and panel changes,
then open either capture for its details. Comparison shows structural counts without exposing panel values.
The debugger runs with its default options out of the box. See the configuration reference for options, collectors and panels, provider integrations such as Inertia and Vite, database thresholds, and IDE links. See the application integration examples for copyable container, logger, middleware, and runner recipes.
The toolbar and debugger routes allow 127.0.0.1 and ::1 by default. Access checks use the direct client address, not
forwarded proxy headers. Add only trusted development addresses to allowedIPs; never expose the debugger publicly.
Request captures redact sensitive fields and URL query values; hand the same capture policy to a provider collector that records user data, as the configuration reference shows. In Logs, the log message is not redacted; the PSR-3 context is redacted by the capture policy; SQL diagnostics can include substituted query values. Treat stored captures as sensitive and review them before sharing. In the Events panel, context capture and source traces are disabled by default; this does not affect source traces in Logs or Database.
Guides for integrating the debugger into a Yii 3 application, configuring it, and validating the package.
- 📚 Getting started
- ⚙️ Configuration reference
- 💡 Application integration examples
- 🖼️ Panel screenshots
- 🧪 Testing guide
The guides and the API reference generated
from the PHPDoc in src/ are published at https://yii2-framework.github.io/docs/extensions/yii3-debug/.
AI agents: read the documentation index and fetch the Markdown version
of a page by appending index.md to its URL. The
AI agents guide covers skill installation, client setup and
verification.
- 🤖
yii3-debug-integrationskill: installing, configuring, and troubleshootingyii3/debugin a Yii 3 application, including Yii Config Plugin groups, DI providers, logger targets, middleware, storage, collectors, and request-level verification.
The hosted Yii3 Debug documentation publishes this adapter; do not substitute the similarly named
yii2-extensions/debug guide or its Yii 2 module APIs. Match the guidance to the installed package files. If a hosted
source is unavailable or does not match, use the repository guides, the
skill source, the source PHPDoc and the changelog.