Overview

Namespaces

  • Baguette
    • Mastodon
      • Config
      • Entity
      • Grant
      • Service
  • GuzzleHttp
    • Cookie
    • Exception
    • Handler
    • Promise
  • Psr
    • Http
      • Message
  • Teto
    • Object

Classes

  • Client
  • HandlerStack
  • MessageFormatter
  • Middleware
  • Pool
  • PrepareBodyMiddleware
  • RedirectMiddleware
  • RequestOptions
  • RetryMiddleware
  • TransferStats
  • UriTemplate

Interfaces

  • ClientInterface

Functions

  • choose_handler
  • debug_resource
  • default_ca_bundle
  • default_user_agent
  • describe_type
  • headers_from_lines
  • is_host_in_noproxy
  • json_decode
  • json_encode
  • normalize_header_keys
  • uri_template
  • Overview
  • Namespace
  • Class

Class HandlerStack

Creates a composed Guzzle handler function by stacking middlewares on top of an HTTP handler function.

Namespace: GuzzleHttp
Located at HandlerStack.php
Methods summary
public static GuzzleHttp\HandlerStack
# create( callable $handler = null )

Creates a default handler stack that can be used by clients.

Creates a default handler stack that can be used by clients.

The returned handler will wrap the provided handler or use the most appropriate default handler for you system. The returned HandlerStack has support for cookies, redirects, HTTP error exceptions, and preparing a body before sending.

The returned handler stack can be passed to a client in the "handler" option.

Parameters

$handler

HTTP handler function to use with the stack. If no handler is provided, the best handler for your system will be utilized.

Returns

GuzzleHttp\HandlerStack
public
# __construct( callable $handler = null )

Parameters

$handler
Underlying HTTP handler.
public
# __invoke( Psr\Http\Message\RequestInterface $request, array $options )

Invokes the handler stack as a composed handler

Invokes the handler stack as a composed handler

Parameters

$request
$options
public string
# __toString( )

Dumps a string representation of the stack.

Dumps a string representation of the stack.

Returns

string
public
# setHandler( callable $handler )

Set the HTTP handler that actually returns a promise.

Set the HTTP handler that actually returns a promise.

Parameters

$handler

Accepts a request and array of options and returns a Promise.

public boolean
# hasHandler( )

Returns true if the builder has a handler.

Returns true if the builder has a handler.

Returns

boolean
public
# unshift( callable $middleware, string $name = null )

Unshift a middleware to the bottom of the stack.

Unshift a middleware to the bottom of the stack.

Parameters

$middleware
Middleware function
$name
Name to register for this middleware.
public
# push( callable $middleware, string $name = '' )

Push a middleware to the top of the stack.

Push a middleware to the top of the stack.

Parameters

$middleware
Middleware function
$name
Name to register for this middleware.
public
# before( string $findName, callable $middleware, string $withName = '' )

Add a middleware before another middleware by name.

Add a middleware before another middleware by name.

Parameters

$findName
Middleware to find
$middleware
Middleware function
$withName
Name to register for this middleware.
public
# after( string $findName, callable $middleware, string $withName = '' )

Add a middleware after another middleware by name.

Add a middleware after another middleware by name.

Parameters

$findName
Middleware to find
$middleware
Middleware function
$withName
Name to register for this middleware.
public
# remove( callable|string $remove )

Remove a middleware by instance or name from the stack.

Remove a middleware by instance or name from the stack.

Parameters

$remove
Middleware to remove by instance or name.
public callable
# resolve( )

Compose the middleware and handler into a single callable function.

Compose the middleware and handler into a single callable function.

Returns

callable
ξ ^ω^)ξ Baguette PHP Mastodon API Client / SDK API documentation generated by ApiGen