Functions used to create and wrap handlers with handler middleware.

CloneableFinalInstantiable
Methods
public static cookies()
 
Middleware that adds cookies to requests.

The options array must be set to a CookieJarInterface in order to use
cookies. This is typically handled for you by a client.

  • return callable Returns a function that accepts the next handler.
public static history( $container)
 
Middleware that pushes history data to an ArrayAccess container.

  • return callable Returns a function that accepts the next handler.
  • throws InvalidArgumentException if container is not an array or ArrayAccess.
public static httpErrors()
 
Middleware that throws exceptions for 4xx or 5xx responses when the "http_error" request option is set to true.

  • return callable Returns a function that accepts the next handler.
public static log(Psr\Log\LoggerInterface $logger, GuzzleHttp\MessageFormatter $formatter, $logLevel = 'info')
 
Middleware that logs requests, responses, and errors using a message formatter.

  • return callable Returns a function that accepts the next handler.
public static mapRequest(callable $fn)
 
Middleware that applies a map function to the request before passing to the next handler.

  • return callable
public static mapResponse(callable $fn)
 
Middleware that applies a map function to the resolved promise's response.

  • return callable
public static prepareBody()
 
This middleware adds a default content-type if possible, a default content-length or transfer-encoding header, and the expect header.

  • return callable
public static redirect()
 
Middleware that handles request redirects.

  • return callable Returns a function that accepts the next handler.
public static retry(callable $decider, ?callable $delay = NULL)
 
Middleware that retries requests based on the boolean result of invoking the provided "decider" function.

If no delay function is provided, a simple implementation of exponential
backoff will be utilized.

  • return callable Returns a function that accepts the next handler.
public static tap(?callable $before = NULL, ?callable $after = NULL)
 
Middleware that invokes a callback before and after sending a request.

The provided listener cannot modify or alter the response. It simply
"taps" into the chain to be notified before returning the promise. The
before listener accepts a request and options array, and the after
listener accepts a request, options array, and response promise.

  • return callable Returns a function that accepts the next handler.
Methods
public static cookies()
 
Middleware that adds cookies to requests.

The options array must be set to a CookieJarInterface in order to use
cookies. This is typically handled for you by a client.

  • return callable Returns a function that accepts the next handler.
public static history( $container)
 
Middleware that pushes history data to an ArrayAccess container.

  • return callable Returns a function that accepts the next handler.
  • throws InvalidArgumentException if container is not an array or ArrayAccess.
public static httpErrors()
 
Middleware that throws exceptions for 4xx or 5xx responses when the "http_error" request option is set to true.

  • return callable Returns a function that accepts the next handler.
public static log(Psr\Log\LoggerInterface $logger, GuzzleHttp\MessageFormatter $formatter, $logLevel = 'info')
 
Middleware that logs requests, responses, and errors using a message formatter.

  • return callable Returns a function that accepts the next handler.
public static mapRequest(callable $fn)
 
Middleware that applies a map function to the request before passing to the next handler.

  • return callable
public static mapResponse(callable $fn)
 
Middleware that applies a map function to the resolved promise's response.

  • return callable
public static prepareBody()
 
This middleware adds a default content-type if possible, a default content-length or transfer-encoding header, and the expect header.

  • return callable
public static redirect()
 
Middleware that handles request redirects.

  • return callable Returns a function that accepts the next handler.
public static retry(callable $decider, ?callable $delay = NULL)
 
Middleware that retries requests based on the boolean result of invoking the provided "decider" function.

If no delay function is provided, a simple implementation of exponential
backoff will be utilized.

  • return callable Returns a function that accepts the next handler.
public static tap(?callable $before = NULL, ?callable $after = NULL)
 
Middleware that invokes a callback before and after sending a request.

The provided listener cannot modify or alter the response. It simply
"taps" into the chain to be notified before returning the promise. The
before listener accepts a request and options array, and the after
listener accepts a request, options array, and response promise.

  • return callable Returns a function that accepts the next handler.
© 2020 Bruce Wells
Search Namespaces \ Classes
ConfigurationNumbers (0-9.) only