Skip to content

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.Kernel · interface and is responsible for capturing a specific type of runtime data during the application lifecycle.

Built-in Collectors

Core Collectors

CollectorData CollectedGuide
LogCollectorAppDevPanel\Kernel\Collector\LogCollectorCollects Log data during application lifecycle.Kernel · class · implements SummaryCollectorInterfacePSR-3 log messages (level, message, context)Log
EventCollectorAppDevPanel\Kernel\Collector\EventCollectorCollects Event data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfacePSR-14 dispatched events and listenersEvent
ExceptionCollectorAppDevPanel\Kernel\Collector\ExceptionCollectorCollects Exception data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfaceUncaught exceptions with stack tracesException
HttpClientCollectorAppDevPanel\Kernel\Collector\HttpClientCollectorCollects Http Client data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfacePSR-18 outgoing HTTP requests and responsesHTTP Client
DatabaseCollectorAppDevPanel\Kernel\Collector\DatabaseCollectorCaptures SQL queries and transactions from the application.final Kernel · class · implements SummaryCollectorInterfaceSQL queries, execution time, transactionsDatabase
ElasticsearchCollectorAppDevPanel\Kernel\Collector\ElasticsearchCollectorCaptures Elasticsearch requests from the application.final Kernel · class · implements SummaryCollectorInterfaceElasticsearch requests, timing, hits countElasticsearch
CacheCollectorAppDevPanel\Kernel\Collector\CacheCollectorCaptures cache operations (get, set, delete) across any caching backend.final Kernel · class · implements SummaryCollectorInterfaceCache get/set/delete operations with hit/miss ratesCache
RedisCollectorAppDevPanel\Kernel\Collector\RedisCollectorCaptures Redis commands (GET, SET, DEL, etc.) across any Redis client.final Kernel · class · implements SummaryCollectorInterfaceRedis commands with timing and error trackingRedis
MailerCollectorAppDevPanel\Kernel\Collector\MailerCollectorCaptures email messages sent by the application.final Kernel · class · implements SummaryCollectorInterfaceSent email messagesMailer
TranslatorCollectorAppDevPanel\Kernel\Collector\TranslatorCollectorCaptures translation lookups during request execution.final Kernel · class · implements SummaryCollectorInterfaceTranslation lookups, missing translationsTranslator
QueueCollectorAppDevPanel\Kernel\Collector\QueueCollectorCaptures message queue and message bus operations.final Kernel · class · implements SummaryCollectorInterfaceMessage queue operations (push, consume, fail)Queue
ServiceCollectorAppDevPanel\Kernel\Collector\ServiceCollectorCollects Service data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfaceDI container service resolutionsService
RouterCollectorAppDevPanel\Kernel\Collector\RouterCollectorCaptures HTTP routing data: matched route, match timing, route tree.final Kernel · class · implements SummaryCollectorInterfaceHTTP route matching dataRouter
MiddlewareCollectorAppDevPanel\Kernel\Collector\MiddlewareCollectorCaptures HTTP middleware stack execution data.final Kernel · class · implements SummaryCollectorInterfaceMiddleware stack execution and timingMiddleware
ValidatorCollectorAppDevPanel\Kernel\Collector\ValidatorCollectorCaptures validation operations with results.final Kernel · class · implements SummaryCollectorInterfaceValidation operations and resultsValidator
AuthorizationCollectorAppDevPanel\Kernel\Collector\AuthorizationCollectorCaptures authentication and authorization data.final Kernel · class · implements SummaryCollectorInterfaceAuthentication and authorization dataAuthorization
TemplateCollectorAppDevPanel\Kernel\Collector\TemplateCollectorCaptures template/view rendering with optional timing, output, parameters, and duplicate detection.final Kernel · class · implements SummaryCollectorInterfaceTemplate/view rendering with timing, output capture, and duplicate detectionTemplate
VarDumperCollectorAppDevPanel\Kernel\Collector\VarDumperCollectorCollects Var Dumper data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfaceManual dump() / dd() callsVarDumper
TimelineCollectorAppDevPanel\Kernel\Collector\TimelineCollectorCollects Timeline data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfaceCross-collector performance timelineTimeline
EnvironmentCollectorAppDevPanel\Kernel\Collector\EnvironmentCollectorCollects runtime environment information: PHP version, extensions, SAPI, OS, working directory, server parameters, and environment variables.final Kernel · class · implements SummaryCollectorInterfacePHP and OS environment infoEnvironment
DeprecationCollectorAppDevPanel\Kernel\Collector\DeprecationCollectorCollects Deprecation data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfacePHP deprecation warningsDeprecation
OpenTelemetryCollectorAppDevPanel\Kernel\Collector\OpenTelemetryCollectorCollects Open Telemetry data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfaceOpenTelemetry spans and tracesOpenTelemetry
AssetBundleCollectorAppDevPanel\Kernel\Collector\AssetBundleCollectorCaptures registered asset bundles from the application.final Kernel · class · implements SummaryCollectorInterfaceFrontend asset bundles (Yii)Asset Bundle
FilesystemStreamCollectorAppDevPanel\Kernel\Collector\Stream\FilesystemStreamCollectorCollects Filesystem Stream data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfaceFilesystem stream operationsFilesystem Stream
HttpStreamCollectorAppDevPanel\Kernel\Collector\Stream\HttpStreamCollectorCollects Http Stream data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfaceHTTP stream wrapper operationsHTTP Stream
CodeCoverageCollectorAppDevPanel\Kernel\Collector\CodeCoverageCollectorCollects Code Coverage data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfacePer-request PHP line coverage (requires pcov or xdebug)Coverage

Web-Specific

CollectorData CollectedGuide
RequestCollectorAppDevPanel\Kernel\Collector\Web\RequestCollectorCollects Request data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfaceIncoming HTTP request and response detailsRequest
WebAppInfoCollectorAppDevPanel\Kernel\Collector\Web\WebAppInfoCollectorCollects Web App Info data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfacePHP version, memory, execution timeWeb App Info

Console-Specific

CollectorData CollectedGuide
CommandCollectorAppDevPanel\Kernel\Collector\Console\CommandCollectorCollects Command data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfaceConsole command executionsCommand
ConsoleAppInfoCollectorAppDevPanel\Kernel\Collector\Console\ConsoleAppInfoCollectorCollects Console App Info data during application lifecycle.final Kernel · class · implements SummaryCollectorInterfaceConsole application metadataConsole App Info

CollectorInterface

Every collector implements five methods:

php
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.final Kernel · class 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
<?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:

  1. Via proxies -- PSR interface proxies (e.g., LoggerInterfaceProxyAppDevPanel\Kernel\Collector\LoggerInterfaceProxyDecorator proxy for Logger Interface. Intercepts calls and forwards data to collectors.final Kernel · class · implements LoggerInterface) intercept calls and feed data to their paired collector automatically.
  2. Via direct calls -- Adapter hooks or application code call methods on the collector directly (e.g., DatabaseCollectorAppDevPanel\Kernel\Collector\DatabaseCollectorCaptures SQL queries and transactions from the application.final Kernel · class · implements SummaryCollectorInterface 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}.Kernel · interface · extends 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}.Kernel · interface · extends 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.final Kernel · class · implements SummaryCollectorInterface 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

  1. On startup(), the collector detects the available driver and starts coverage collection
  2. Your application code runs normally — every executed PHP line is tracked
  3. On shutdown(), coverage is stopped and raw data is processed into per-file statistics
  4. Files matching excludePaths (default: vendor) are filtered out

Enabling

Code coverage is opt-in (disabled by default) due to performance overhead.

yaml
# config/packages/app_dev_panel.yaml
app_dev_panel:
    collectors:
        code_coverage: true

Output Format

json
{
    "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.

Released under the MIT License.