Collectors
Collectors are the core data-gathering mechanism in ADP. Each collector implements CollectorInterfaceAppDevPanel\Kernel\Collector\CollectorInterfaceDebug data collector responsibility is to collect data during application lifecycle. and is responsible for capturing a specific type of runtime data during the application lifecycle.
Built-in Collectors
Core Collectors
Web-Specific
| Collector | Data Collected | Guide |
|---|---|---|
RequestCollectorAppDevPanel\Kernel\Collector\Web\RequestCollectorCollects Request data during application lifecycle. | Incoming HTTP request and response details | Request |
WebAppInfoCollectorAppDevPanel\Kernel\Collector\Web\WebAppInfoCollectorCollects Web App Info data during application lifecycle. | PHP version, memory, execution time | Web App Info |
Console-Specific
| Collector | Data Collected | Guide |
|---|---|---|
CommandCollectorAppDevPanel\Kernel\Collector\Console\CommandCollectorCollects Command data during application lifecycle. | Console command executions | Command |
ConsoleAppInfoCollectorAppDevPanel\Kernel\Collector\Console\ConsoleAppInfoCollectorCollects Console App Info data during application lifecycle. | Console application metadata | Console App Info |
CollectorInterface
Every collector implements five methods:
interface CollectorInterface
{
public function getId(): string; // Unique ID (typically FQCN)
public function getName(): string; // Human-readable short name
public function startup(): void; // Called at request start
public function shutdown(): void; // Called at request end
public function getCollected(): array; // Returns all collected data
}The DebuggerAppDevPanel\Kernel\DebuggerClass Debugger. calls startup() on all registered collectors at the beginning of a request, and shutdown() followed by getCollected() at the end.
Creating a Custom Collector
<?php
declare(strict_types=1);
namespace App\Debug;
use AppDevPanel\Kernel\Collector\CollectorInterface;
final class MetricsCollector implements CollectorInterface
{
private array $metrics = [];
public function getId(): string
{
return self::class;
}
public function getName(): string
{
return 'metrics';
}
public function startup(): void
{
$this->metrics = [];
}
public function shutdown(): void
{
// Finalize data if needed
}
public function getCollected(): array
{
return $this->metrics;
}
public function record(string $name, float $value): void
{
$this->metrics[] = ['name' => $name, 'value' => $value];
}
}Register the collector in your framework adapter's DI configuration so the Debugger picks it up automatically.
Data Flow
Collectors receive data in two ways:
- Via proxies -- PSR interface proxies (e.g., LoggerInterfaceProxy
AppDevPanel\Kernel\Collector\LoggerInterfaceProxyDecorator proxy for Logger Interface. Intercepts calls and forwards data to collectors.) intercept calls and feed data to their paired collector automatically. - Via direct calls -- Adapter hooks or application code call methods on the collector directly (e.g., DatabaseCollector
AppDevPanel\Kernel\Collector\DatabaseCollectorCaptures SQL queries and transactions from the application. receives query data from framework-specific database hooks).
SummaryCollectorInterface
Collectors can also implement SummaryCollectorInterfaceAppDevPanel\Kernel\Collector\SummaryCollectorInterfaceSummary data collector responsibility is to collect summary data for a collector. Summary is used to display a list of previous requests and select one to display full info. Its data set is specific to the list and is reduced compared to full data collected in {@see CollectorInterface}. to provide summary data displayed in the debug entry list without loading full collector data.
TranslatorCollector
Captures translation lookups during request execution, including missing translation detection. Implements SummaryCollectorInterfaceAppDevPanel\Kernel\Collector\SummaryCollectorInterfaceSummary data collector responsibility is to collect summary data for a collector. Summary is used to display a list of previous requests and select one to display full info. Its data set is specific to the list and is reduced compared to full data collected in {@see CollectorInterface}..
See the dedicated Translator page for full details: TranslationRecord fields, collected data structure, missing detection logic, framework proxy integrations, and configuration examples.
Code Coverage Collector
CodeCoverageCollectorAppDevPanel\Kernel\Collector\CodeCoverageCollectorCollects Code Coverage data during application lifecycle. captures per-request PHP line coverage using pcov or xdebug as the coverage driver.
Prerequisites
Requires the pcov extension (recommended) or xdebug with coverage mode enabled. Without either, the collector returns an empty result with driver: null.
How It Works
- On
startup(), the collector detects the available driver and starts coverage collection - Your application code runs normally — every executed PHP line is tracked
- On
shutdown(), coverage is stopped and raw data is processed into per-file statistics - Files matching
excludePaths(default:vendor) are filtered out
Enabling
Code coverage is opt-in (disabled by default) due to performance overhead.
# config/packages/app_dev_panel.yaml
app_dev_panel:
collectors:
code_coverage: trueOutput Format
{
"driver": "pcov",
"files": {
"/app/src/Controller/HomeController.php": {
"coveredLines": 12,
"executableLines": 15,
"percentage": 80.0
}
},
"summary": {
"totalFiles": 42,
"coveredLines": 340,
"executableLines": 500,
"percentage": 68.0
}
}Inspector Endpoint
The inspector also provides a live coverage endpoint at GET /inspect/api/coverage that performs a one-shot coverage collection. See Inspector Endpoints for details.