Psr18Transport
in package
implements
PayloadTransport, PayloadUploadTransport
FinalYes
Default PSR-18 JSON and bounded runtime-payload transport.
Table of Contents
Interfaces
- PayloadTransport
- Optional binary capability; existing JSON-only custom transports remain valid.
- PayloadUploadTransport
- Optional upload capability; download-only custom transports remain compatible.
Properties
- $client : ClientInterface
- $requestFactory : RequestFactoryInterface
- $streamFactory : StreamFactoryInterface
Methods
- __construct() : mixed
- fetchPayload() : string
- Fetch bounded bytes without following redirects and verify declared response metadata.
- send() : array<string, mixed>|array<int, mixed>|null
- uploadPayload() : array<string, mixed>
- Upload encoded bytes without redirects; return a bounded JSON response.
- sendRequest() : ResponseInterface
Properties
$client read-only
private
ClientInterface
$client
$requestFactory read-only
private
RequestFactoryInterface
$requestFactory
$streamFactory read-only
private
StreamFactoryInterface
$streamFactory
Methods
__construct()
public
__construct([ClientInterface|null $client = null ][, RequestFactoryInterface|null $requestFactory = null ][, StreamFactoryInterface|null $streamFactory = null ]) : mixed
Parameters
- $client : ClientInterface|null = null
- $requestFactory : RequestFactoryInterface|null = null
- $streamFactory : StreamFactoryInterface|null = null
fetchPayload()
Fetch bounded bytes without following redirects and verify declared response metadata.
public
fetchPayload(string $uri, array<string|int, mixed> $headers, int $maxBytes) : string
Parameters
- $uri : string
- $headers : array<string|int, mixed>
- $maxBytes : int
Return values
stringsend()
public
send(string $method, string $uri, array<string, string> $headers[, array<string, mixed>|null $body = null ]) : array<string, mixed>|array<int, mixed>|null
Parameters
- $method : string
- $uri : string
- $headers : array<string, string>
- $body : array<string, mixed>|null = null
Return values
array<string, mixed>|array<int, mixed>|nulluploadPayload()
Upload encoded bytes without redirects; return a bounded JSON response.
public
uploadPayload(string $uri, array<string|int, mixed> $headers, string $blob, int $timeoutSeconds) : array<string, mixed>
Parameters
- $uri : string
- $headers : array<string|int, mixed>
- $blob : string
- $timeoutSeconds : int
Return values
array<string, mixed>sendRequest()
private
sendRequest(RequestInterface $request[, bool $stream = false ][, int $timeoutSeconds = 30 ]) : ResponseInterface
Parameters
- $request : RequestInterface
- $stream : bool = false
- $timeoutSeconds : int = 30