Skip to content

Command Collector ​

Captures console command executions — command name, input/output, arguments, options, exit code, and errors.

What It Captures ​

FieldDescription
nameCommand name
commandCommand object
inputCommand input string
outputCommand output
exitCodeProcess exit code
errorError message if command failed
argumentsCommand arguments
optionsCommand options

Data Schema ​

json
{
    "command": {
        "name": "app:import-users",
        "class": "App\\Command\\ImportUsersCommand",
        "input": "app:import-users --force",
        "output": "Imported 42 users.",
        "exitCode": 0,
        "error": null,
        "arguments": {},
        "options": {"force": true}
    }
}

Summary (shown in debug entry list):

json
{
    "command": {
        "name": "app:import-users",
        "class": "App\\Command\\ImportUsersCommand",
        "input": "app:import-users --force",
        "exitCode": 0
    }
}

Contract ​

php
use AppDevPanel\Kernel\Collector\Console\CommandCollector;

// Collect from Symfony Console events
$collector->collect(event: $consoleEvent);

// Or collect raw command data
$collector->collectCommandData([
    'name' => 'app:import-users',
    'input' => 'app:import-users --force',
    'exitCode' => 0,
]);

How It Works ​

Framework adapters hook into console event lifecycle:

  • Symfony: ConsoleCommandEvent, ConsoleTerminateEvent, ConsoleErrorEvent
  • Laravel: Artisan command events
  • Yii 3: Console application events

Debug Panel ​

  • Command details — name, class, input, and exit code
  • Output capture — full command output
  • Error display — error message and trace for failed commands

Released under the MIT License.