Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
GuzzleHttp Namespace Reference

  More...

Namespaces

namespace  Cookie
 
namespace  Exception
  
 
namespace  Handler
  
 
namespace  Promise
  
 
namespace  Psr7
  
 

Classes

class  BodySummarizer
 
interface  BodySummarizerInterface
 
class  Client
 
interface  ClientInterface
 
interface  MessageFormatterInterface
 
class  Middleware
 
class  Pool
 
class  PrepareBodyMiddleware
 
class  RedirectMiddleware
 
class  RequestOptions
 
class  RetryMiddleware
 
class  TransferStats
 
class  Utils
 

Functions

 choose_handler ()
 Chooses and creates a default handler to use based on the environment.
 
 debug_resource ($value=null)
 Returns a debug stream based on the provided variable.
 
 default_ca_bundle ()
 Returns the default cacert bundle for the current system.
 
 default_user_agent ()
 Get the default User-Agent string to use with Guzzle.
 
 delete ($uri, array $options=[])
 Create and send an HTTP DELETE request.
 
 deleteAsync ($uri, array $options=[])
 Create and send an asynchronous HTTP DELETE request.
 
 describe_type ($input)
 
 get ($uri, array $options=[])
 Create and send an HTTP GET request.
 
 getAsync ($uri, array $options=[])
 Create and send an asynchronous HTTP GET request.
 
 head ($uri, array $options=[])
 Create and send an HTTP HEAD request.
 
 headAsync ($uri, array $options=[])
 Create and send an asynchronous HTTP HEAD request.
 
 headers_from_lines (iterable $lines)
 Parses an array of header lines into an associative array of headers.
 
 is_host_in_noproxy (string $host, array $noProxyArray)
 Returns true if the provided host matches any of the no proxy areas.
 
 json_decode (string $json, bool $assoc=false, int $depth=512, int $options=0)
 Wrapper for json_decode that throws when an error occurs.
 
 json_encode ($value, int $options=0, int $depth=512)
 Wrapper for JSON encoding that throws when an error occurs.
 
 normalize_header_keys (array $headers)
 Creates an associative array of lowercase header names to the actual header casing.
 
 patch ($uri, array $options=[])
 Create and send an HTTP PATCH request.
 
 patchAsync ($uri, array $options=[])
 Create and send an asynchronous HTTP PATCH request.
 
 post ($uri, array $options=[])
 Create and send an HTTP POST request.
 
 postAsync ($uri, array $options=[])
 Create and send an asynchronous HTTP POST request.
 
 put ($uri, array $options=[])
 Create and send an HTTP PUT request.
 
 putAsync ($uri, array $options=[])
 Create and send an asynchronous HTTP PUT request.
 
 requestAsync (string $method, $uri, array $options=[])
 Create and send an asynchronous HTTP request.
 

Variables

trait ClientTrait
 

Detailed Description

 

Function Documentation

◆ choose_handler()

GuzzleHttp\choose_handler ( )

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

The returned handler is not wrapped by any default middlewares.

Exceptions
RuntimeExceptionif no viable Handler is available.
Return values
callable(\Psr\Http\Message\RequestInterface,array)GuzzleHttp\Promise\PromiseInterface Returns the best handler for the given system.
Deprecated
choose_handler will be removed in guzzlehttp/guzzle:8.0. Use Utils\chooseHandler instead.

◆ debug_resource()

GuzzleHttp\debug_resource ( $value = null)

Returns a debug stream based on the provided variable.

Parameters
mixed$valueOptional value
Return values
resource
Deprecated
debug_resource will be removed in guzzlehttp/guzzle:8.0. Use Utils\debugResource instead.

◆ default_ca_bundle()

GuzzleHttp\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.

Exceptions
RuntimeExceptionif no bundle can be found.
Deprecated
default_ca_bundle will be removed in guzzlehttp/guzzle:8.0. This function is not needed in PHP 5.6+.

◆ default_user_agent()

GuzzleHttp\default_user_agent ( )

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

Deprecated
default_user_agent will be removed in guzzlehttp/guzzle:8.0. Use Utils\defaultUserAgent instead.

◆ delete()

GuzzleHttp\delete ( $uri,
array $options = [] )

Create and send an HTTP DELETE 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
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.
Exceptions
GuzzleException

◆ deleteAsync()

GuzzleHttp\deleteAsync ( $uri,
array $options = [] )

Create and send an asynchronous HTTP DELETE 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
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.

◆ get()

GuzzleHttp\get ( $uri,
array $options = [] )

Create and send an HTTP GET 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
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.
Exceptions
GuzzleException

◆ getAsync()

GuzzleHttp\getAsync ( $uri,
array $options = [] )

Create and send an asynchronous HTTP GET 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
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.

◆ head()

GuzzleHttp\head ( $uri,
array $options = [] )

Create and send an HTTP HEAD 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
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.
Exceptions
GuzzleException

◆ headAsync()

GuzzleHttp\headAsync ( $uri,
array $options = [] )

Create and send an asynchronous HTTP HEAD 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
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.

◆ headers_from_lines()

GuzzleHttp\headers_from_lines ( iterable $lines)

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

Parameters
iterable$linesHeader lines array of strings in the following format: "Name: Value"
Deprecated
headers_from_lines will be removed in guzzlehttp/guzzle:8.0. Use Utils\headersFromLines instead.

◆ is_host_in_noproxy()

GuzzleHttp\is_host_in_noproxy ( string $host,
array $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$hostHost to check against the patterns.
string[]$noProxyArrayAn array of host patterns.
Exceptions
Exception\InvalidArgumentException
Deprecated
is_host_in_noproxy will be removed in guzzlehttp/guzzle:8.0. Use Utils\isHostInNoProxy instead.

◆ json_decode()

GuzzleHttp\json_decode ( string $json,
bool $assoc = false,
int $depth = 512,
int $options = 0 )

Wrapper for json_decode that throws when an error occurs.

Parameters
string$jsonJSON data to parse
bool$assocWhen true, returned objects will be converted into associative arrays.
int$depthUser specified recursion depth.
int$optionsBitmask of JSON decode options.
Return values
object|array|string|int|float|bool|null
Exceptions
Exception\InvalidArgumentExceptionif the JSON cannot be decoded.

@externalurl https://www.php.net/manual/en/function.json-decode.php

Deprecated
json_decode will be removed in guzzlehttp/guzzle:8.0. Use Utils\jsonDecode instead.

◆ json_encode()

GuzzleHttp\json_encode ( $value,
int $options = 0,
int $depth = 512 )

Wrapper for JSON encoding that throws when an error occurs.

Parameters
mixed$valueThe value being encoded
int$optionsJSON encode option bitmask
int$depthSet the maximum depth. Must be greater than zero.
Exceptions
Exception\InvalidArgumentExceptionif the JSON cannot be encoded.

@externalurl https://www.php.net/manual/en/function.json-encode.php

Deprecated
json_encode will be removed in guzzlehttp/guzzle:8.0. Use Utils\jsonEncode instead.

◆ normalize_header_keys()

GuzzleHttp\normalize_header_keys ( array $headers)

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

Deprecated
normalize_header_keys will be removed in guzzlehttp/guzzle:8.0. Use Utils\normalizeHeaderKeys instead.

◆ patch()

GuzzleHttp\patch ( $uri,
array $options = [] )

Create and send an HTTP PATCH 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
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.
Exceptions
GuzzleException

◆ patchAsync()

GuzzleHttp\patchAsync ( $uri,
array $options = [] )

Create and send an asynchronous HTTP PATCH 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
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.

◆ post()

GuzzleHttp\post ( $uri,
array $options = [] )

Create and send an HTTP POST 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
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.
Exceptions
GuzzleException

◆ postAsync()

GuzzleHttp\postAsync ( $uri,
array $options = [] )

Create and send an asynchronous HTTP POST 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
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.

◆ put()

GuzzleHttp\put ( $uri,
array $options = [] )

Create and send an HTTP PUT 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
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.
Exceptions
GuzzleException

◆ putAsync()

GuzzleHttp\putAsync ( $uri,
array $options = [] )

Create and send an asynchronous HTTP PUT 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
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.

◆ requestAsync()

GuzzleHttp\requestAsync ( string $method,
$uri,
array $options = [] )
abstract

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
string$methodHTTP method
string | UriInterface$uriURI object or string.
array$optionsRequest options to apply.

Variable Documentation

◆ ClientTrait

trait GuzzleHttp\ClientTrait
Initial value:
{
abstract public function request(string $method, $uri, array $options = []): ResponseInterface