Proxy
in package
Provides basic proxies for handlers.
Tags
Table of Contents
Methods
- wrapStreaming() : callable(RequestInterface, array<string|int, mixed>): PromiseInterface
- Sends streaming requests to a streaming compatible handler while sending all other requests to a default handler.
- wrapSync() : callable(RequestInterface, array<string|int, mixed>): PromiseInterface
- Sends synchronous requests to a specific handler while sending all other requests to another handler.
Methods
wrapStreaming()
Sends streaming requests to a streaming compatible handler while sending all other requests to a default handler.
public
static wrapStreaming(callable(RequestInterface, array<string|int, mixed>): PromiseInterface $default, callable(RequestInterface, array<string|int, mixed>): PromiseInterface $streaming) : callable(RequestInterface, array<string|int, mixed>): PromiseInterface
This, for example, could be useful for taking advantage of the performance benefits of curl while still supporting true streaming through the StreamHandler.
Parameters
- $default : callable(RequestInterface, array<string|int, mixed>): PromiseInterface
-
Handler used for non-streaming responses
- $streaming : callable(RequestInterface, array<string|int, mixed>): PromiseInterface
-
Handler used for streaming responses
Return values
callable(RequestInterface, array<string|int, mixed>): PromiseInterface —Returns the composed handler.
wrapSync()
Sends synchronous requests to a specific handler while sending all other requests to another handler.
public
static wrapSync(callable(RequestInterface, array<string|int, mixed>): PromiseInterface $default, callable(RequestInterface, array<string|int, mixed>): PromiseInterface $sync) : callable(RequestInterface, array<string|int, mixed>): PromiseInterface
Parameters
- $default : callable(RequestInterface, array<string|int, mixed>): PromiseInterface
-
Handler used for normal responses
- $sync : callable(RequestInterface, array<string|int, mixed>): PromiseInterface
-
Handler used for synchronous responses.
Return values
callable(RequestInterface, array<string|int, mixed>): PromiseInterface —Returns the composed handler.