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);
Tags
implements

Interfaces

Carrier
Carrier for propagating context across process boundaries.

Methods

__construct()  : mixed
get()  : null|string
Get a value by key.
set()  : static
Set a value.
unwrap()  : array<string, string>
Unwrap and return the underlying data structure.

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) : static
Parameters
$key : string

The key to set

$value : string

The value to set

Return values
static

For fluent chaining

unwrap()

Unwrap and return the underlying data structure.

public unwrap() : array<string, string>
Return values
array<string, string>

        
On this page

Search results