ConsoleAppInfoCollector
collects information about the application.
It uses the following events to collect data:
\Yiisoft\Yii\Console\Event\ApplicationStartup
\Yiisoft\Yii\Console\Event\ApplicationShutdown
\Symfony\Component\Console\Event\ConsoleCommandEvent
\Symfony\Component\Console\Event\ConsoleTerminateEvent
\Symfony\Component\Console\Event\ConsoleErrorEvent
Example:
console/commands.php
return [
'app:hello' => \App\Command\HelloCommand::class,
];
App\Command\HelloCommand
final class HelloCommand extends Command
{
protected static $defaultName = 'app:hello';
protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln('Hello world!');
return 0;
}
}
Output:
{
"applicationProcessingTime": 0.016509056091308594,
"preloadTime": -0.014687061309814453,
"applicationEmit": 0.0016329288482666016,
"requestProcessingTime": 0.00018906593322753906,
"memoryPeakUsage": 16445144,
"memoryUsage": 16347512
}
{
"console": {
"php": {
"version": "8.2.8"
},
"request": {
"startTime": 1704625438.335058,
"processingTime": 0.00018906593322753906
},
"memory": {
"peakUsage": 20338080
}
}
}