\GuzzleHttp

Namespaces

Cookie
Exception
Handler
Promise
Psr7

Traits

ClientTrait Client interface for sending HTTP requests.

Interfaces

BodySummarizerInterface
ClientInterface Client interface for sending HTTP requests.
MessageFormatterInterface

Classes

BodySummarizer
Client
HandlerStack Creates a composed Guzzle handler function by stacking middlewares on top of an HTTP handler function.
MessageFormatter Formats log messages using variable substitutions for requests, responses, and other transactional data.
Middleware Functions used to create and wrap handlers with handler middleware.
Pool Sends an iterator of requests concurrently using a capped pool size.
PrepareBodyMiddleware Prepares requests that contain a body, adding the Content-Length, Content-Type, and Expect headers.
RedirectMiddleware Request redirect middleware.
RequestOptions This class contains a list of built-in Guzzle request options.
RetryMiddleware Middleware that retries requests based on the boolean result of invoking the provided "decider" function.
TransferStats Represents data at the point after it was transferred either successfully or after a network error.
Utils

Functions

choose_handler()

choose_handler() : callable

Chooses and creates a default handler to use based on the environment.

The returned handler is not wrapped by any default middlewares.

Throws

\RuntimeException

if no viable Handler is available.

Returns

callable —

debug_resource()

debug_resource(mixed  $value = null) : resource

Returns a debug stream based on the provided variable.

Parameters

mixed $value

Optional value

Returns

resource —

default_ca_bundle()

default_ca_bundle() : string

Returns the default cacert bundle for the current system.

First, the openssl.cafile and curl.cainfo php.ini settings are checked. If those settings are not configured, then the common locations for bundles found on Red Hat, CentOS, Fedora, Ubuntu, Debian, FreeBSD, OS X and Windows are checked. If any of these file locations are found on disk, they will be utilized.

Note: the result of this function is cached for subsequent calls.

Throws

\RuntimeException

if no bundle can be found.

Returns

string —

default_user_agent()

default_user_agent() : string

Get the default User-Agent string to use with Guzzle.

Returns

string —

describe_type()

describe_type(mixed  $input) : string

Debug function used to describe the provided value type and class.

Parameters

mixed $input

Any type of variable to describe the type of. This parameter misses a typehint because of that.

Returns

string —

Returns a string containing the type of the variable and if a class is provided, the class name.

headers_from_lines()

headers_from_lines(iterable  $lines) : array

Parses an array of header lines into an associative array of headers.

Parameters

iterable $lines

Header lines array of strings in the following format: "Name: Value"

Returns

array —

is_host_in_noproxy()

is_host_in_noproxy(string  $host, string[]  $noProxyArray) : bool

Returns true if the provided host matches any of the no proxy areas.

This method will strip a port from the host if it is present. Each pattern can be matched with an exact match (e.g., "foo.com" == "foo.com") or a partial match: (e.g., "foo.com" == "baz.foo.com" and ".foo.com" == "baz.foo.com", but ".foo.com" != "foo.com").

Areas are matched in the following cases:

  1. "*" (without quotes) always matches any hosts.
  2. An exact match.
  3. The area starts with "." and the area is the last part of the host. e.g. '.mit.edu' will match any host that ends with '.mit.edu'.

Parameters

string $host

Host to check against the patterns.

string[] $noProxyArray

An array of host patterns.

Throws

\GuzzleHttp\Exception\InvalidArgumentException

Returns

bool —

json_decode()

json_decode(string  $json, bool  $assoc = false, int  $depth = 512, int  $options) : object|array|string|int|float|bool|null

Wrapper for json_decode that throws when an error occurs.

Parameters

string $json

JSON data to parse

bool $assoc

When true, returned objects will be converted into associative arrays.

int $depth

User specified recursion depth.

int $options

Bitmask of JSON decode options.

Throws

\GuzzleHttp\Exception\InvalidArgumentException

if the JSON cannot be decoded.

Returns

object|array|string|int|float|bool|null —

json_encode()

json_encode(mixed  $value, int  $options, int  $depth = 512) : string

Wrapper for JSON encoding that throws when an error occurs.

Parameters

mixed $value

The value being encoded

int $options

JSON encode option bitmask

int $depth

Set the maximum depth. Must be greater than zero.

Throws

\GuzzleHttp\Exception\InvalidArgumentException

if the JSON cannot be encoded.

Returns

string —

normalize_header_keys()

normalize_header_keys(array  $headers) : array

Creates an associative array of lowercase header names to the actual header casing.

Parameters

array $headers

Returns

array —