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 Client

GuzzleHttp\Client implements GuzzleHttp\ClientInterface
Namespace: GuzzleHttp
Located at Client.php
Methods summary
public
# __construct( array $config = [] )

Clients accept an array of constructor parameters.

Clients accept an array of constructor parameters.

Here's an example of creating a client using a base_uri and an array of default request options to apply to each request: $client = new Client([ 'base_uri' => 'http://www.foo.com/1.0/', 'timeout' => 0, 'allow_redirects' => false, 'proxy' => '192.168.16.1:10' ]);

Client configuration settings include the following options:

  • handler: (callable) Function that transfers HTTP requests over the wire. The function is called with a Psr7\Http\Message\RequestInterface and array of transfer options, and must return a GuzzleHttp\Promise\PromiseInterface that is fulfilled with a Psr7\Http\Message\ResponseInterface on success. "handler" is a constructor only option that cannot be overridden in per/request options. If no handler is provided, a default handler will be created that enables all of the request options below by attaching all of the default middleware to the handler.
  • base_uri: (string|UriInterface) Base URI of the client that is merged into relative URIs. Can be a string or instance of UriInterface.
  • **: any request option

Parameters

$config
Client configuration settings.

See

\GuzzleHttp\RequestOptions for a list of available request options.
public
# __call( $method, $args )
public PromiseInterface
# sendAsync( Psr\Http\Message\RequestInterface $request, array $options = [] )

Asynchronously send an HTTP request.

Asynchronously send an HTTP request.

Parameters

$request
Request to send
$options

Request options to apply to the given request and to the transfer.

Returns

PromiseInterface

Implementation of

GuzzleHttp\ClientInterface::sendAsync()
public Psr\Http\Message\ResponseInterface
# send( Psr\Http\Message\RequestInterface $request, array $options = [] )

Send an HTTP request.

Send an HTTP request.

Parameters

$request
Request to send
$options

Request options to apply to the given request and to the transfer.

Returns

Psr\Http\Message\ResponseInterface

Throws

GuzzleException

Implementation of

GuzzleHttp\ClientInterface::send()
public PromiseInterface
# requestAsync( string $method, string|Psr\Http\Message\UriInterface $uri = '', array $options = [] )

Create and send an asynchronous HTTP request.

Create and send an asynchronous HTTP request.

Use an absolute path to override the base path of the client, or a relative path to append to the base path of the client. The URL can contain the query string as well. Use an array to provide a URL template and additional variables to use in the URL template expansion.

Parameters

$method
HTTP method
$uri
URI object or string.
$options
Request options to apply.

Returns

PromiseInterface

Implementation of

GuzzleHttp\ClientInterface::requestAsync()
public Psr\Http\Message\ResponseInterface
# request( string $method, string|Psr\Http\Message\UriInterface $uri = '', array $options = [] )

Create and send an HTTP request.

Create and send an HTTP request.

Use an absolute path to override the base path of the client, or a relative path to append to the base path of the client. The URL can contain the query string as well.

Parameters

$method
HTTP method.
$uri
URI object or string.
$options
Request options to apply.

Returns

Psr\Http\Message\ResponseInterface

Throws

GuzzleException

Implementation of

GuzzleHttp\ClientInterface::request()
public mixed
# getConfig( string|null $option = null )

Get a client configuration option.

Get a client configuration option.

These options include default request options of the client, a "handler" (if utilized by the concrete client), and a "base_uri" if utilized by the concrete client.

Parameters

$option
The config option to retrieve.

Returns

mixed

Implementation of

GuzzleHttp\ClientInterface::getConfig()
Magic methods summary
public Psr\Http\Message\ResponseInterface
# get( string|Psr\Http\Message\UriInterface $uri, array $options = [] )

Parameters

$uri
$options

Returns

Psr\Http\Message\ResponseInterface
public Psr\Http\Message\ResponseInterface
# head( string|Psr\Http\Message\UriInterface $uri, array $options = [] )

Parameters

$uri
$options

Returns

Psr\Http\Message\ResponseInterface
public Psr\Http\Message\ResponseInterface
# put( string|Psr\Http\Message\UriInterface $uri, array $options = [] )

Parameters

$uri
$options

Returns

Psr\Http\Message\ResponseInterface
public Psr\Http\Message\ResponseInterface
# post( string|Psr\Http\Message\UriInterface $uri, array $options = [] )

Parameters

$uri
$options

Returns

Psr\Http\Message\ResponseInterface
public Psr\Http\Message\ResponseInterface
# patch( string|Psr\Http\Message\UriInterface $uri, array $options = [] )

Parameters

$uri
$options

Returns

Psr\Http\Message\ResponseInterface
public Psr\Http\Message\ResponseInterface
# delete( string|Psr\Http\Message\UriInterface $uri, array $options = [] )

Parameters

$uri
$options

Returns

Psr\Http\Message\ResponseInterface
public GuzzleHttp\Promise\PromiseInterface
# getAsync( string|Psr\Http\Message\UriInterface $uri, array $options = [] )

Parameters

$uri
$options

Returns

GuzzleHttp\Promise\PromiseInterface
public GuzzleHttp\Promise\PromiseInterface
# headAsync( string|Psr\Http\Message\UriInterface $uri, array $options = [] )

Parameters

$uri
$options

Returns

GuzzleHttp\Promise\PromiseInterface
public GuzzleHttp\Promise\PromiseInterface
# putAsync( string|Psr\Http\Message\UriInterface $uri, array $options = [] )

Parameters

$uri
$options

Returns

GuzzleHttp\Promise\PromiseInterface
public GuzzleHttp\Promise\PromiseInterface
# postAsync( string|Psr\Http\Message\UriInterface $uri, array $options = [] )

Parameters

$uri
$options

Returns

GuzzleHttp\Promise\PromiseInterface
public GuzzleHttp\Promise\PromiseInterface
# patchAsync( string|Psr\Http\Message\UriInterface $uri, array $options = [] )

Parameters

$uri
$options

Returns

GuzzleHttp\Promise\PromiseInterface
public GuzzleHttp\Promise\PromiseInterface
# deleteAsync( string|Psr\Http\Message\UriInterface $uri, array $options = [] )

Parameters

$uri
$options

Returns

GuzzleHttp\Promise\PromiseInterface
Constants inherited from GuzzleHttp\ClientInterface
VERSION
ξ ^ω^)ξ Baguette PHP Mastodon API Client / SDK API documentation generated by ApiGen