Skip to content

HTTP Client Collector ​

Captures outgoing PSR-18 HTTP requests and responses with timing and status codes.

HTTP Client Collector panel

What It Captures ​

FieldDescription
methodHTTP method (GET, POST, etc.)
uriRequest URI
headersRequest headers
lineSource file and line of the HTTP call
responseStatusResponse HTTP status code
responseRawRaw response body
totalTimeTotal request/response time in seconds

Data Schema ​

json
[
    {
        "startTime": 1711878000.100,
        "endTime": 1711878000.350,
        "totalTime": 0.25,
        "method": "GET",
        "uri": "https://api.example.com/users/42",
        "headers": {"Authorization": "Bearer ***"},
        "line": "/app/src/ApiClient.php:55",
        "responseRaw": "{\"id\": 42, \"name\": \"John\"}",
        "responseStatus": 200
    }
]

Summary (shown in debug entry list):

json
{
    "http": {
        "count": 3,
        "totalTime": 0.75
    }
}

Contract ​

php
use AppDevPanel\Kernel\Collector\HttpClientCollector;

// Start collection
$collector->collect(
    request: $psrRequest,
    startTime: microtime(true),
    line: '/app/src/ApiClient.php:55',
    uniqueId: 'req-1',
);

// Complete with response
$collector->collectTotalTime(
    response: $psrResponse,
    endTime: microtime(true),
    uniqueId: 'req-1',
);

How It Works ​

The collector is fed by HttpClientInterfaceProxyAppDevPanel\Kernel\Collector\HttpClientInterfaceProxyDecorator proxy for Http Client Interface. Intercepts calls and forwards data to collectors.final Kernel · class · implements ClientInterface — a PSR-18 ClientInterfacePsr\Http\Client\ClientInterfacePSR-18 HTTP Client Interface. Sends PSR-7 requests and returns PSR-7 responses.PSR-18 · interface decorator. Every $client->sendRequest($request) call is automatically intercepted, timed, and recorded.

Debug Panel ​

  • Request list — all outgoing HTTP calls with method, URL, status, and timing
  • Request/response details — expandable view with headers and body
  • Status badges — color-coded by response status (2xx green, 4xx orange, 5xx red)
  • Timing breakdown — per-request duration

Released under the MIT License.