\GuzzleHttp

Namespaces

Cookie
Exception
Handler
Promise
Psr7

Traits

ClientTrait Client interface for sending HTTP requests.

Classes

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.

Functions

choose_handler()

choose_handler() : \GuzzleHttp\callable(\Psr\Http\Message\RequestInterface,

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

\GuzzleHttp\callable(\Psr\Http\Message\RequestInterface, —

array): \GuzzleHttp\Promise\PromiseInterface Returns the best handler for the given system.

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() 

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.

default_user_agent()

default_user_agent() 

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

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(\GuzzleHttp\iterable  $lines) 

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

Parameters

\GuzzleHttp\iterable $lines

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

is_host_in_noproxy()

is_host_in_noproxy(string  $host, array<mixed,string>  $noProxyArray) 

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.

array<mixed,string> $noProxyArray

An array of host patterns.

Throws

\GuzzleHttp\Exception\InvalidArgumentException

json_decode()

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

Wrapper for json_decode that throws when an error occurs.

Parameters

string $json

JSON data to parse

boolean $assoc

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

integer $depth

User specified recursion depth.

integer $options

Bitmask of JSON decode options.

Throws

\GuzzleHttp\Exception\InvalidArgumentException

if the JSON cannot be decoded.

Returns

object|array|string|integer|float|boolean|null

json_encode()

json_encode(mixed  $value, integer  $options, integer  $depth = 512) 

Wrapper for JSON encoding that throws when an error occurs.

Parameters

mixed $value

The value being encoded

integer $options

JSON encode option bitmask

integer $depth

Set the maximum depth. Must be greater than zero.

Throws

\GuzzleHttp\Exception\InvalidArgumentException

if the JSON cannot be encoded.

normalize_header_keys()

normalize_header_keys(array  $headers) 

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

Parameters

array $headers