Profile Yii 2 requests and console commands with low-friction performance monitoring
Perfbase gives Yii 2 teams framework-aware request tracing, command visibility, and production-ready profiling without building custom event wrappers around every workflow.
Why teams choose Perfbase for Yii 2
Bootstrap component for early registration
Request and console coverage from one package
Shutdown fallback for fatal-error visibility
Yii 2
Performance monitoring for Yii 2 applications
Supported versions
Yii 2.0.45+
Quick install
composer require perfbase/yii2Starter config
// config/web.php
'bootstrap' => ['perfbase'],
'components' => [
'perfbase' => [
'class' => Perfbase\Yii2\PerfbaseComponent::class,
'enabled' => true,
'api_key' => 'your-api-key',
],
]Use cases
Why teams use Perfbase for Yii 2
Perfbase is built for teams that need more than a local debug toolbar. It brings production-facing traces, framework-specific context, and shared visibility across the slow paths that matter most in Yii 2.
Understand route-level latency in context
See how request handling, controllers, and downstream calls combine to slow down Yii 2 responses.
Keep operational commands visible
Profile console commands with the same tooling you use for web traffic instead of separating them mentally and technically.
Adopt profiling without custom scaffolding
Leverage Yii 2 event hooks directly instead of writing your own wrappers around the framework lifecycle.
Profiling coverage
What gets profiled and how Perfbase works in Yii 2
Perfbase stays framework-aware while keeping setup light. These are the behaviors and operational paths this integration is built to expose.
HTTP profiling
Automatic profiling via EVENT_BEFORE_ACTION and EVENT_AFTER_REQUEST.
Console command profiling
Console commands are profiled automatically via the same event mechanism.
Bootstrap component
Implements BootstrapInterface for early event listener registration.
Shutdown fallback
ErrorHandler shutdown events ensure traces are submitted on fatal errors.
Include and exclude filters
Filter by route, controller, method, or command name.
Fail-open design
Profiling errors never crash your application. Debug mode is available for development.
Setup preview
How to get started with Perfbase in Yii 2
Start with install, configuration, and the first framework-specific profiling steps here. When you want full implementation detail, each card links directly into the complete guide.
Installation
Install the Perfbase PHP extension first. This is what does the actual profiling:
Open docs section →
Configuration
Register the component and add it to the bootstrap array in your application config:
Open docs section →
HTTP profiling
HTTP requests are profiled automatically via Yii 2 application events, with no middleware, behaviors, or filters needed.
Open docs section →
Console command profiling
Console commands are profiled automatically using the same event mechanism. The command name is resolved from the action's unique ID, falling back to the requested route or unknown.
Open docs section →
FAQ
Yii 2 profiler and performance monitoring FAQ
Does Perfbase support both web and console execution in Yii 2?
Yes. Perfbase supports Yii 2 HTTP requests and console commands so teams can profile the full application surface area.
Can Perfbase survive fatal errors in Yii 2?
Yes. A shutdown fallback is used so traces can still be submitted when request execution ends badly.
Do I need custom instrumentation around every controller?
No. Perfbase plugs into Yii 2 lifecycle events so most profiling works automatically.
Start profiling
Ready to start profiling production traffic?
Create a project, install the package, and start capturing framework-level traces in minutes.