Flow PHP

SuperglobalCarrier implements Carrier

Read onlyYes
FinalYes

Read-only carrier backed by PHP superglobals.

Reads context from $_SERVER (HTTP headers), $_GET, $_POST, and $_COOKIE. This carrier is read-only and will throw if set() is called.

HTTP headers in $SERVER are normalized from HTTP* format:

  • HTTP_TRACEPARENT becomes 'traceparent'
  • HTTP_X_CUSTOM_HEADER becomes 'x-custom-header'

Example usage:

$propagator = new CompositePropagator([
    new W3CTraceContext(),
    new W3CBaggage(),
]);

$carrier = new SuperglobalCarrier();
$ctx = $propagator->extract($carrier);

Interfaces

Carrier
Carrier for propagating context across process boundaries.

Methods

get()  : null|string
Get a value by key.
set()  : void
Set a value.

Methods

get()

Get a value by key.

public get(string $key) : null|string

Key lookup should be case-insensitive for HTTP header compatibility.

Parameters
$key : string

The key to look up

Return values
null|string

The value, or null if not found

set()

Set a value.

public set(string $key, string $value) : void
Parameters
$key : string

The key to set

$value : string

The value to set


        
On this page

Search results