W3CBaggage implements Propagator
Read onlyYes
FinalYes
W3C Baggage propagator for propagating application-specific data.
Implements the W3C Baggage specification for propagating key-value pairs across service boundaries using HTTP headers.
Header format: baggage: key1=value1,key2=value2;property1;property2=propValue
Note: Properties (metadata for baggage entries) are parsed but not preserved in the current implementation as they are rarely used.
Example usage:
$propagator = new W3CBaggage();
// Extract from incoming request
$carrier = new ArrayCarrier($headers);
$ctx = $propagator->extract($carrier);
$baggage = $ctx->baggage;
// Inject into outgoing request
$carrier = new ArrayCarrier();
$propagator->inject(new PropagationContext(baggage: $baggage), $carrier);
$headers = $carrier->toArray();
Tags
Interfaces
- Propagator
- Interface for propagating context across process boundaries.
Constants
- HEADER_BAGGAGE = 'baggage'
Methods
- extract() : PropagationContext
- Extract context from a carrier.
- fields() : array<string|int, string>
- Get the list of header/field names this propagator uses.
- inject() : void
- Inject context into a carrier.
Constants
HEADER_BAGGAGE
public
mixed
HEADER_BAGGAGE
= 'baggage'
Methods
extract()
Extract context from a carrier.
public
extract(Carrier $carrier) : PropagationContext
Parameters
- $carrier : Carrier
-
The carrier to extract from
Return values
PropagationContext —The extracted context
fields()
Get the list of header/field names this propagator uses.
public
fields() : array<string|int, string>
Return values
array<string|int, string>inject()
Inject context into a carrier.
public
inject(PropagationContext $context, Carrier $carrier) : void
Parameters
- $context : PropagationContext
-
The context to inject
- $carrier : Carrier
-
The carrier to inject into