WebAppInfoCollector
collects information about the application.
It uses the following events to collect data:
\Yiisoft\Yii\Http\Event\ApplicationStartup
\Yiisoft\Yii\Http\Event\ApplicationShutdown
\Yiisoft\Yii\Http\Event\BeforeRequest
\Yiisoft\Yii\Http\Event\AfterRequest
\Yiisoft\Yii\Http\Event\AfterEmit
Example:
final class SiteController
{
public function __construct(private ViewRenderer $viewRenderer)
{
$this->viewRenderer = $viewRenderer->withController($this);
}
public function index(): ResponseInterface
{
return $this->viewRenderer->render('index');
}
}
Output:
{
"applicationProcessingTime": 1704545635.136016,
"requestProcessingTime": 0.17957496643066406,
"applicationEmit": 0.00048089027404785156,
"preloadTime": 1704545634.95596,
"memoryPeakUsage": 10567480,
"memoryUsage": 2170160
}
{
"web": {
"php": {
"version": "8.2.8"
},
"request": {
"startTime": 1704545634.95596,
"processingTime": 0.17957496643066406
},
"memory": {
"peakUsage": 10567480
}
}
}