Skip to content

Service Collector

Captures DI container service method calls — invoked service, method, arguments, result, and timing.

Service Collector panel

What It Captures

FieldDescription
serviceService identifier
classService class name
methodMethod called
argumentsMethod arguments
resultReturn value
statusCall status (success or error)
errorError message if failed
timeStartCall start time
timeEndCall end time

Data Schema

json
[
    {
        "service": "App\\Service\\UserService",
        "class": "App\\Service\\UserService",
        "method": "findById",
        "arguments": [42],
        "result": {"id": 42, "name": "John"},
        "status": "success",
        "error": null,
        "timeStart": 1711878000.100,
        "timeEnd": 1711878000.105
    }
]

Summary (shown in debug entry list):

json
{
    "service": {
        "total": 5
    }
}

Contract

php
use AppDevPanel\Kernel\Collector\ServiceCollector;
use AppDevPanel\Kernel\Event\MethodCallRecord;

$collector->collect(new MethodCallRecord(
    service: 'App\\Service\\UserService',
    class: 'App\\Service\\UserService',
    method: 'findById',
    arguments: [42],
    result: $result,
    status: 'success',
    timeStart: $start,
    timeEnd: $end,
));

How It Works

The collector is fed by ContainerInterfaceProxyAppDevPanel\Adapter\Yii3\Proxy\ContainerInterfaceProxyDecorator proxy for Container Interface. Intercepts calls and forwards data to collectors.final Adapter/Yii3 · class · implements ContainerInterface which wraps the PSR-11 ContainerInterfacePsr\Container\ContainerInterfacePSR-11 Container Interface. Describes the interface of a dependency injection container.PSR-11 · interface. When services are resolved and their methods are called through the proxy, the calls are intercepted and recorded.

Debug Panel

  • Service call list — all tracked method calls with class, method, and timing
  • Expandable details — arguments and return values
  • Status indicators — success (green) and error (red) badges

Released under the MIT License.