yii3 / debug
Yii3 adapter for the PHP Forge debug core.
Requires
- php: >=8.3
- composer-runtime-api: ^2.2
- php-forge/debug: ^0.3
- php-forge/debug-core: ^0.1@dev
- psr/container: ^2.0
- 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
- ui-awesome/html-core-component: ^0.4
- yiisoft/aliases: ^3.1
- yiisoft/assets: ^5.1
- yiisoft/data: ^2.0
- yiisoft/db: ^2.0
- yiisoft/definitions: ^3.4
- yiisoft/di: ^1.2
- 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/view: ^12.2
- yiisoft/yii-dataview: dev-master
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
- php-forge/inertia: ^0.5@dev
- php-forge/vite: ^0.5@dev
- 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
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-19 19:59:03 UTC
README
Debug
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.
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
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-rebuild
Applications that build their middleware list by hand must spread the merged
$params['yiisoft/middleware-dispatcher']['middlewares'] first, so the toolbar middleware stays in the pipeline.
The middleware also answers the /debug pages itself, so the debugger publishes no routes and needs none of your
application's routing.
The debugger attaches itself to Yiisoft\Db\Connection\ConnectionInterface and
Psr\EventDispatcher\EventDispatcherInterface through the container, using the di-providers and bootstrap
configuration groups; both must belong to the provider and bootstrap groups your runner loads. Your services keep
their own definitions and the debugger only decorates them, so a custom PSR dispatcher needs no separate integration.
The Logs panel works through parameters instead: the debugger merges its debug target, and a stream target, into
yiisoft/log.targets, so your application must build Psr\Log\LoggerInterface from
$params['yiisoft/log']['targets']. The yiisoft/app template already builds the logger this way:
'targets' => ReferencesArray::from( array_values($params['yiisoft/log']['targets'] ?? [StreamTarget::class]), ),
An application that hardcodes its target list keeps working, but its Logs panel stays empty. A template that relies on
the ?? [StreamTarget::class] fallback needs no parameters of its own: the merged key bypasses that fallback, yet it
already carries a stream target beside the debugger's. Declare targets under that key to add your own, or to replace
a merged one under the same name:
'yiisoft/log' => [ 'targets' => [ 'file' => \Yiisoft\Log\Target\File\FileTarget::class, ], ],
The snapshot itself is written when the application dispatches Yiisoft\Yii\Http\Event\ApplicationShutdown, through
the merged events-web listeners the Yii HTTP runner uses. Finalizing there, rather than inside the middleware
pipeline, is what makes the logs, the profiler spans flushed after emission, and the queries issued while the view is
rendered lazily complete in the capture. See Capture lifecycle.
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
The debugger runs with its default options out of the box. See the configuration reference for registering collectors and panels, provider integrations such as Inertia and Vite, database thresholds, and IDE links.
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 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. 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.