yii3 / debug
Yii3 adapter for the PHP Forge debug core.
Requires
- php: >=8.3
- composer-runtime-api: ^2.2
- php-forge/debug-core: ^0.1@dev
- php-forge/vite: ^0.2.1
- psr/event-dispatcher: ^1.0
- psr/http-factory: ^1.1
- psr/http-message: ^1.1 || ^2.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
- psr/log: ^3.0
- ui-awesome/html: ^0.6
- yiisoft/aliases: ^3.1
- yiisoft/assets: ^5.1
- yiisoft/data: ^2.0
- yiisoft/db: ^2.0
- yiisoft/definitions: ^3.4
- yiisoft/event-dispatcher: ^1.1
- yiisoft/html: ^4.2
- yiisoft/http: ^1.3
- yiisoft/log: ^2.2
- yiisoft/network-utilities: ^1.2
- yiisoft/profiler: ^3.0
- yiisoft/router: ^4.0
- yiisoft/validator: ^2.1
- yiisoft/view: ^12.2
- yiisoft/yii-dataview: dev-master
- yiisoft/yii-middleware: ^1.1
Requires (Dev)
- httpsoft/http-message: ^1.1
- infection/infection: ^0.34
- maglnet/composer-require-checker: ^4.1
- php-forge/baseline: ^0.1
- php-forge/coding-standard: ^0.3
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0.3
- phpunit/phpunit: ^12.5
- yii2-extensions/scaffold: ^0.2
- yiisoft/config: ^1.6
- yiisoft/db-sqlite: ^2.0
- yiisoft/router-fastroute: ^4.0
Suggests
- yii3/inertia: Enables the optional Inertia integration (^0.1).
- yiisoft/db: Enables optional Yii DB 2 instrumentation and EXPLAIN (^2.0; install a driver).
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-09 18:54:06 UTC
README
Debug
Debugger and toolbar for Yii3 applications
Shared Debug Core UI, scoped CSS, light/dark mode, and opt-in Inertia/Vite 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.
Features
Quick start
Installation
Requires PHP 8.3 or newer and a Yii3 application using Yii Config Plugin.
composer require yii3/debug --dev
Enable the debugger
Set the vendor override layer in your application's composer.json, keeping any existing extra settings:
{
"extra": {
"config-plugin-options": {
"vendor-override-layer": "yii3/debug"
}
}
}
Rebuild the application configuration after changing this setting:
composer yii-config-rebuild
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.
The package registers its routes, toolbar middleware, logging, and event capture automatically. Your application
must use the merged yiisoft/middleware-dispatcher.middlewares parameters for its middleware pipeline. If it defines
its own logger, preserve the targets in yiisoft/log.targets; custom PSR loggers and event dispatchers need a
separate integration.
Basic usage
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.
Configuration
Override only the options you need in your application's parameters:
return [ 'yii3/debug' => [ 'allowedIPs' => ['127.0.0.1', '::1'], 'historySize' => 50, 'routePrefix' => '/debug', 'storage' => [ 'path' => '@runtime/debug', ], 'toolbar' => [ 'position' => 'bottom', ], ], ];
These are the defaults: local access only, up to 50 retained requests, and captures stored under @runtime/debug.
Changing routePrefix also changes the History URL. The storage path accepts a registered Yii alias.
Inertia and Vite
Enable either integration when your application uses the corresponding package:
return [ 'yii3/debug' => [ 'extensions' => [ 'inertia' => true, 'vite' => true, ], ], ];
Both are disabled by default. Inertia requires a compatible yii3/inertia ^0.1 revision providing
Yii3\Inertia\ResolvedPageObserver. Vite uses the application's existing php-forge/vite configuration and entrypoints.
Keep the debugger, Debug Core, and enabled integration packages up to date together in the application's lock file.
An extension appears in the sidebar only when the selected request contains its data. Vite's Production label means it is inspecting built assets in your development application, not that the debugger can run in production.
Database
Database capture requires a Yii DB 2 driver and an instrumented application connection. For example, if your SQLite
application already registers its configured connection as Yiisoft\Db\Sqlite\Connection, add this factory to your
development-only DI configuration. The container supplies that connection and the debugger's registered profiler:
use Yii3\Debug\Db\DebugDbProfiler; use Yiisoft\Db\Connection\ConnectionInterface; use Yiisoft\Db\Sqlite\Connection; return [ ConnectionInterface::class => static function ( Connection $connection, DebugDbProfiler $debugDbProfiler, ): ConnectionInterface { $debugDbProfiler->instrument($connection); return $connection; }, ];
Keep the existing concrete Connection registration and its driver settings; it must not resolve back to
ConnectionInterface. For another PDO driver, use its configured concrete connection class instead of SQLite's.
EXPLAIN supports MySQL, SQLite, and PostgreSQL and
requires the application's Yiisoft\Db\Connection\ConnectionInterface binding to match the captured queries.
Leave EXPLAIN unconfigured when one binding cannot represent all captured connections.
IDE links
Source traces use ide:// links by default. Set traceLine to false for plain file names and line numbers, or
provide your editor's URL template in the yii3/debug parameters:
'traceLine' => '<a href="phpstorm://open?file={file}&line={line}">{text}</a>',
For containers or remote environments, map captured paths to your local project:
'tracePathMappings' => ['/var/www/html' => '/home/developer/projects/app'],
Security
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 and Inertia captures redact sensitive fields and URL query values. Logs preserve original diagnostic values and are not 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.
Screenshots
Expand a panel to preview it. Images follow your GitHub light or dark theme.
History
Request
Logs
This capture contains no log messages; the panel displays its empty state.
Events
Profiling
Database
Configuration
PHP info
Inertia
Vite