Documentation

RequestOptions
in package

This class contains a list of built-in Guzzle request options.

More documentation for each option can be found at http://guzzlephp.org/.

Tags
link
http://docs.guzzlephp.org/en/v6/request-options.html

Table of Contents

ALLOW_REDIRECTS  = 'allow_redirects'
allow_redirects: (bool|array) Controls redirect behavior. Pass false to disable redirects, pass true to enable redirects, pass an associative to provide custom redirect settings. Defaults to "false".
AUTH  = 'auth'
auth: (array) Pass an array of HTTP authentication parameters to use with the request. The array must contain the username in index [0], the password in index [1], and you can optionally provide a built-in authentication type in index [2]. Pass null to disable authentication for a request.
BODY  = 'body'
body: (resource|string|null|int|float|StreamInterface|callable|\Iterator) Body to send in the request.
CERT  = 'cert'
cert: (string|array) Set to a string to specify the path to a file containing a PEM formatted SSL client side certificate. If a password is required, then set cert to an array containing the path to the PEM file in the first array element followed by the certificate password in the second array element.
CONNECT_TIMEOUT  = 'connect_timeout'
connect_timeout: (float, default=0) Float describing the number of seconds to wait while trying to connect to a server. Use 0 to wait indefinitely (the default behavior).
COOKIES  = 'cookies'
cookies: (bool|GuzzleHttp\Cookie\CookieJarInterface, default=false) Specifies whether or not cookies are used in a request or what cookie jar to use or what cookies to send. This option only works if your handler has the `cookie` middleware. Valid values are `false` and an instance of {@see \GuzzleHttp\Cookie\CookieJarInterface}.
DEBUG  = 'debug'
debug: (bool|resource) Set to true or set to a PHP stream returned by fopen() enable debug output with the HTTP handler used to send a request.
DECODE_CONTENT  = 'decode_content'
decode_content: (bool, default=true) Specify whether or not Content-Encoding responses (gzip, deflate, etc.) are automatically decoded.
DELAY  = 'delay'
delay: (int) The amount of time to delay before sending in milliseconds.
EXPECT  = 'expect'
expect: (bool|integer) Controls the behavior of the "Expect: 100-Continue" header.
FORCE_IP_RESOLVE  = 'force_ip_resolve'
force_ip_resolve: (bool) Force client to use only ipv4 or ipv6 protocol
FORM_PARAMS  = 'form_params'
form_params: (array) Associative array of form field names to values where each value is a string or array of strings. Sets the Content-Type header to application/x-www-form-urlencoded when no Content-Type header is already present.
HEADERS  = 'headers'
headers: (array) Associative array of HTTP headers. Each value MUST be a string or array of strings.
HTTP_ERRORS  = 'http_errors'
http_errors: (bool, default=true) Set to false to disable exceptions when a non- successful HTTP response is received. By default, exceptions will be thrown for 4xx and 5xx responses. This option only works if your handler has the `httpErrors` middleware.
IDN_CONVERSION  = 'idn_conversion'
idn: (bool|int, default=true) A combination of IDNA_* constants for idn_to_ascii() PHP's function (see "options" parameter). Set to false to disable IDN support completely, or to true to use the default configuration (IDNA_DEFAULT constant).
JSON  = 'json'
json: (mixed) Adds JSON data to a request. The provided value is JSON encoded and a Content-Type header of application/json will be added to the request if no Content-Type header is already present.
MULTIPART  = 'multipart'
multipart: (array) Array of associative arrays, each containing a required "name" key mapping to the form field, name, a required "contents" key mapping to a StreamInterface|resource|string, an optional "headers" associative array of custom headers, and an optional "filename" key mapping to a string to send as the filename in the part. If no "filename" key is present, then no "filename" attribute will be added to the part.
ON_HEADERS  = 'on_headers'
on_headers: (callable) A callable that is invoked when the HTTP headers of the response have been received but the body has not yet begun to download.
ON_STATS  = 'on_stats'
on_stats: (callable) allows you to get access to transfer statistics of a request and access the lower level transfer details of the handler associated with your client. ``on_stats`` is a callable that is invoked when a handler has finished sending a request. The callback is invoked with transfer statistics about the request, the response received, or the error encountered. Included in the data is the total amount of time taken to send the request.
PROGRESS  = 'progress'
progress: (callable) Defines a function to invoke when transfer progress is made. The function accepts the following positional arguments: the total number of bytes expected to be downloaded, the number of bytes downloaded so far, the number of bytes expected to be uploaded, the number of bytes uploaded so far.
PROXY  = 'proxy'
proxy: (string|array) Pass a string to specify an HTTP proxy, or an array to specify different proxies for different protocols (where the key is the protocol and the value is a proxy string).
QUERY  = 'query'
query: (array|string) Associative array of query string values to add to the request. This option uses PHP's http_build_query() to create the string representation. Pass a string value if you need more control than what this method provides
READ_TIMEOUT  = 'read_timeout'
read_timeout: (float, default=default_socket_timeout ini setting) Float describing the body read timeout, for stream requests.
SINK  = 'sink'
sink: (resource|string|StreamInterface) Where the data of the response is written to. Defaults to a PHP temp stream. Providing a string will write data to a file by the given name.
SSL_KEY  = 'ssl_key'
ssl_key: (array|string) Specify the path to a file containing a private SSL key in PEM format. If a password is required, then set to an array containing the path to the SSL key in the first array element followed by the password required for the certificate in the second element.
STREAM  = 'stream'
stream: Set to true to attempt to stream a response rather than download it all up-front.
SYNCHRONOUS  = 'synchronous'
synchronous: (bool) Set to true to inform HTTP handlers that you intend on waiting on the response. This can be useful for optimizations. Note that a promise is still returned if you are using one of the async client methods.
TIMEOUT  = 'timeout'
timeout: (float, default=0) Float describing the timeout of the request in seconds. Use 0 to wait indefinitely (the default behavior).
VERIFY  = 'verify'
verify: (bool|string, default=true) Describes the SSL certificate verification behavior of a request. Set to true to enable SSL certificate verification using the system CA bundle when available (the default). Set to false to disable certificate verification (this is insecure!). Set to a string to provide the path to a CA bundle on disk to enable verification using a custom certificate.
VERSION  = 'version'
version: (float) Specifies the HTTP protocol version to attempt to use.

Constants

ALLOW_REDIRECTS

allow_redirects: (bool|array) Controls redirect behavior. Pass false to disable redirects, pass true to enable redirects, pass an associative to provide custom redirect settings. Defaults to "false".

public mixed ALLOW_REDIRECTS = 'allow_redirects'

This option only works if your handler has the RedirectMiddleware. When passing an associative array, you can provide the following key value pairs:

  • max: (int, default=5) maximum number of allowed redirects.
  • strict: (bool, default=false) Set to true to use strict redirects meaning redirect POST requests with POST requests vs. doing what most browsers do which is redirect POST requests with GET requests
  • referer: (bool, default=false) Set to true to enable the Referer header.
  • protocols: (array, default=['http', 'https']) Allowed redirect protocols.
  • on_redirect: (callable) PHP callable that is invoked when a redirect is encountered. The callable is invoked with the request, the redirect response that was received, and the effective URI. Any return value from the on_redirect function is ignored.

AUTH

auth: (array) Pass an array of HTTP authentication parameters to use with the request. The array must contain the username in index [0], the password in index [1], and you can optionally provide a built-in authentication type in index [2]. Pass null to disable authentication for a request.

public mixed AUTH = 'auth'

BODY

body: (resource|string|null|int|float|StreamInterface|callable|\Iterator) Body to send in the request.

public mixed BODY = 'body'

CERT

cert: (string|array) Set to a string to specify the path to a file containing a PEM formatted SSL client side certificate. If a password is required, then set cert to an array containing the path to the PEM file in the first array element followed by the certificate password in the second array element.

public mixed CERT = 'cert'

CONNECT_TIMEOUT

connect_timeout: (float, default=0) Float describing the number of seconds to wait while trying to connect to a server. Use 0 to wait indefinitely (the default behavior).

public mixed CONNECT_TIMEOUT = 'connect_timeout'

COOKIES

cookies: (bool|GuzzleHttp\Cookie\CookieJarInterface, default=false) Specifies whether or not cookies are used in a request or what cookie jar to use or what cookies to send. This option only works if your handler has the `cookie` middleware. Valid values are `false` and an instance of {@see \GuzzleHttp\Cookie\CookieJarInterface}.

public mixed COOKIES = 'cookies'

DEBUG

debug: (bool|resource) Set to true or set to a PHP stream returned by fopen() enable debug output with the HTTP handler used to send a request.

public mixed DEBUG = 'debug'

DECODE_CONTENT

decode_content: (bool, default=true) Specify whether or not Content-Encoding responses (gzip, deflate, etc.) are automatically decoded.

public mixed DECODE_CONTENT = 'decode_content'

DELAY

delay: (int) The amount of time to delay before sending in milliseconds.

public mixed DELAY = 'delay'

EXPECT

expect: (bool|integer) Controls the behavior of the "Expect: 100-Continue" header.

public mixed EXPECT = 'expect'

Set to true to enable the "Expect: 100-Continue" header for all requests that sends a body. Set to false to disable the "Expect: 100-Continue" header for all requests. Set to a number so that the size of the payload must be greater than the number in order to send the Expect header. Setting to a number will send the Expect header for all requests in which the size of the payload cannot be determined or where the body is not rewindable.

By default, Guzzle will add the "Expect: 100-Continue" header when the size of the body of a request is greater than 1 MB and a request is using HTTP/1.1.

FORCE_IP_RESOLVE

force_ip_resolve: (bool) Force client to use only ipv4 or ipv6 protocol

public mixed FORCE_IP_RESOLVE = 'force_ip_resolve'

FORM_PARAMS

form_params: (array) Associative array of form field names to values where each value is a string or array of strings. Sets the Content-Type header to application/x-www-form-urlencoded when no Content-Type header is already present.

public mixed FORM_PARAMS = 'form_params'

HEADERS

headers: (array) Associative array of HTTP headers. Each value MUST be a string or array of strings.

public mixed HEADERS = 'headers'

HTTP_ERRORS

http_errors: (bool, default=true) Set to false to disable exceptions when a non- successful HTTP response is received. By default, exceptions will be thrown for 4xx and 5xx responses. This option only works if your handler has the `httpErrors` middleware.

public mixed HTTP_ERRORS = 'http_errors'

IDN_CONVERSION

idn: (bool|int, default=true) A combination of IDNA_* constants for idn_to_ascii() PHP's function (see "options" parameter). Set to false to disable IDN support completely, or to true to use the default configuration (IDNA_DEFAULT constant).

public mixed IDN_CONVERSION = 'idn_conversion'

JSON

json: (mixed) Adds JSON data to a request. The provided value is JSON encoded and a Content-Type header of application/json will be added to the request if no Content-Type header is already present.

public mixed JSON = 'json'

MULTIPART

multipart: (array) Array of associative arrays, each containing a required "name" key mapping to the form field, name, a required "contents" key mapping to a StreamInterface|resource|string, an optional "headers" associative array of custom headers, and an optional "filename" key mapping to a string to send as the filename in the part. If no "filename" key is present, then no "filename" attribute will be added to the part.

public mixed MULTIPART = 'multipart'

ON_HEADERS

on_headers: (callable) A callable that is invoked when the HTTP headers of the response have been received but the body has not yet begun to download.

public mixed ON_HEADERS = 'on_headers'

ON_STATS

on_stats: (callable) allows you to get access to transfer statistics of a request and access the lower level transfer details of the handler associated with your client. ``on_stats`` is a callable that is invoked when a handler has finished sending a request. The callback is invoked with transfer statistics about the request, the response received, or the error encountered. Included in the data is the total amount of time taken to send the request.

public mixed ON_STATS = 'on_stats'

PROGRESS

progress: (callable) Defines a function to invoke when transfer progress is made. The function accepts the following positional arguments: the total number of bytes expected to be downloaded, the number of bytes downloaded so far, the number of bytes expected to be uploaded, the number of bytes uploaded so far.

public mixed PROGRESS = 'progress'

PROXY

proxy: (string|array) Pass a string to specify an HTTP proxy, or an array to specify different proxies for different protocols (where the key is the protocol and the value is a proxy string).

public mixed PROXY = 'proxy'

QUERY

query: (array|string) Associative array of query string values to add to the request. This option uses PHP's http_build_query() to create the string representation. Pass a string value if you need more control than what this method provides

public mixed QUERY = 'query'

READ_TIMEOUT

read_timeout: (float, default=default_socket_timeout ini setting) Float describing the body read timeout, for stream requests.

public mixed READ_TIMEOUT = 'read_timeout'

SINK

sink: (resource|string|StreamInterface) Where the data of the response is written to. Defaults to a PHP temp stream. Providing a string will write data to a file by the given name.

public mixed SINK = 'sink'

SSL_KEY

ssl_key: (array|string) Specify the path to a file containing a private SSL key in PEM format. If a password is required, then set to an array containing the path to the SSL key in the first array element followed by the password required for the certificate in the second element.

public mixed SSL_KEY = 'ssl_key'

STREAM

stream: Set to true to attempt to stream a response rather than download it all up-front.

public mixed STREAM = 'stream'

SYNCHRONOUS

synchronous: (bool) Set to true to inform HTTP handlers that you intend on waiting on the response. This can be useful for optimizations. Note that a promise is still returned if you are using one of the async client methods.

public mixed SYNCHRONOUS = 'synchronous'

TIMEOUT

timeout: (float, default=0) Float describing the timeout of the request in seconds. Use 0 to wait indefinitely (the default behavior).

public mixed TIMEOUT = 'timeout'

VERIFY

verify: (bool|string, default=true) Describes the SSL certificate verification behavior of a request. Set to true to enable SSL certificate verification using the system CA bundle when available (the default). Set to false to disable certificate verification (this is insecure!). Set to a string to provide the path to a CA bundle on disk to enable verification using a custom certificate.

public mixed VERIFY = 'verify'

VERSION

version: (float) Specifies the HTTP protocol version to attempt to use.

public mixed VERSION = 'version'

Search results