1<?php
2
3namespace GuzzleHttp;
4
5/**
6 * This class contains a list of built-in Guzzle request options.
7 *
8 * More documentation for each option can be found at http://guzzlephp.org/.
9 *
10 * @link http://docs.guzzlephp.org/en/v6/request-options.html
11 */
12final class RequestOptions
13{
14    /**
15     * allow_redirects: (bool|array) Controls redirect behavior. Pass false
16     * to disable redirects, pass true to enable redirects, pass an
17     * associative to provide custom redirect settings. Defaults to "false".
18     * This option only works if your handler has the RedirectMiddleware. When
19     * passing an associative array, you can provide the following key value
20     * pairs:
21     *
22     * - max: (int, default=5) maximum number of allowed redirects.
23     * - strict: (bool, default=false) Set to true to use strict redirects
24     *   meaning redirect POST requests with POST requests vs. doing what most
25     *   browsers do which is redirect POST requests with GET requests
26     * - referer: (bool, default=false) Set to true to enable the Referer
27     *   header.
28     * - protocols: (array, default=['http', 'https']) Allowed redirect
29     *   protocols.
30     * - on_redirect: (callable) PHP callable that is invoked when a redirect
31     *   is encountered. The callable is invoked with the request, the redirect
32     *   response that was received, and the effective URI. Any return value
33     *   from the on_redirect function is ignored.
34     */
35    public const ALLOW_REDIRECTS = 'allow_redirects';
36
37    /**
38     * auth: (array) Pass an array of HTTP authentication parameters to use
39     * with the request. The array must contain the username in index [0],
40     * the password in index [1], and you can optionally provide a built-in
41     * authentication type in index [2]. Pass null to disable authentication
42     * for a request.
43     */
44    public const AUTH = 'auth';
45
46    /**
47     * body: (resource|string|null|int|float|StreamInterface|callable|\Iterator)
48     * Body to send in the request.
49     */
50    public const BODY = 'body';
51
52    /**
53     * cert: (string|array) Set to a string to specify the path to a file
54     * containing a PEM formatted SSL client side certificate. If a password
55     * is required, then set cert to an array containing the path to the PEM
56     * file in the first array element followed by the certificate password
57     * in the second array element.
58     */
59    public const CERT = 'cert';
60
61    /**
62     * cookies: (bool|GuzzleHttp\Cookie\CookieJarInterface, default=false)
63     * Specifies whether or not cookies are used in a request or what cookie
64     * jar to use or what cookies to send. This option only works if your
65     * handler has the `cookie` middleware. Valid values are `false` and
66     * an instance of {@see \GuzzleHttp\Cookie\CookieJarInterface}.
67     */
68    public const COOKIES = 'cookies';
69
70    /**
71     * connect_timeout: (float, default=0) Float describing the number of
72     * seconds to wait while trying to connect to a server. Use 0 to wait
73     * indefinitely (the default behavior).
74     */
75    public const CONNECT_TIMEOUT = 'connect_timeout';
76
77    /**
78     * debug: (bool|resource) Set to true or set to a PHP stream returned by
79     * fopen()  enable debug output with the HTTP handler used to send a
80     * request.
81     */
82    public const DEBUG = 'debug';
83
84    /**
85     * decode_content: (bool, default=true) Specify whether or not
86     * Content-Encoding responses (gzip, deflate, etc.) are automatically
87     * decoded.
88     */
89    public const DECODE_CONTENT = 'decode_content';
90
91    /**
92     * delay: (int) The amount of time to delay before sending in milliseconds.
93     */
94    public const DELAY = 'delay';
95
96    /**
97     * expect: (bool|integer) Controls the behavior of the
98     * "Expect: 100-Continue" header.
99     *
100     * Set to `true` to enable the "Expect: 100-Continue" header for all
101     * requests that sends a body. Set to `false` to disable the
102     * "Expect: 100-Continue" header for all requests. Set to a number so that
103     * the size of the payload must be greater than the number in order to send
104     * the Expect header. Setting to a number will send the Expect header for
105     * all requests in which the size of the payload cannot be determined or
106     * where the body is not rewindable.
107     *
108     * By default, Guzzle will add the "Expect: 100-Continue" header when the
109     * size of the body of a request is greater than 1 MB and a request is
110     * using HTTP/1.1.
111     */
112    public const EXPECT = 'expect';
113
114    /**
115     * form_params: (array) Associative array of form field names to values
116     * where each value is a string or array of strings. Sets the Content-Type
117     * header to application/x-www-form-urlencoded when no Content-Type header
118     * is already present.
119     */
120    public const FORM_PARAMS = 'form_params';
121
122    /**
123     * headers: (array) Associative array of HTTP headers. Each value MUST be
124     * a string or array of strings.
125     */
126    public const HEADERS = 'headers';
127
128    /**
129     * http_errors: (bool, default=true) Set to false to disable exceptions
130     * when a non- successful HTTP response is received. By default,
131     * exceptions will be thrown for 4xx and 5xx responses. This option only
132     * works if your handler has the `httpErrors` middleware.
133     */
134    public const HTTP_ERRORS = 'http_errors';
135
136    /**
137     * idn: (bool|int, default=true) A combination of IDNA_* constants for
138     * idn_to_ascii() PHP's function (see "options" parameter). Set to false to
139     * disable IDN support completely, or to true to use the default
140     * configuration (IDNA_DEFAULT constant).
141     */
142    public const IDN_CONVERSION = 'idn_conversion';
143
144    /**
145     * json: (mixed) Adds JSON data to a request. The provided value is JSON
146     * encoded and a Content-Type header of application/json will be added to
147     * the request if no Content-Type header is already present.
148     */
149    public const JSON = 'json';
150
151    /**
152     * multipart: (array) Array of associative arrays, each containing a
153     * required "name" key mapping to the form field, name, a required
154     * "contents" key mapping to a StreamInterface|resource|string, an
155     * optional "headers" associative array of custom headers, and an
156     * optional "filename" key mapping to a string to send as the filename in
157     * the part. If no "filename" key is present, then no "filename" attribute
158     * will be added to the part.
159     */
160    public const MULTIPART = 'multipart';
161
162    /**
163     * on_headers: (callable) A callable that is invoked when the HTTP headers
164     * of the response have been received but the body has not yet begun to
165     * download.
166     */
167    public const ON_HEADERS = 'on_headers';
168
169    /**
170     * on_stats: (callable) allows you to get access to transfer statistics of
171     * a request and access the lower level transfer details of the handler
172     * associated with your client. ``on_stats`` is a callable that is invoked
173     * when a handler has finished sending a request. The callback is invoked
174     * with transfer statistics about the request, the response received, or
175     * the error encountered. Included in the data is the total amount of time
176     * taken to send the request.
177     */
178    public const ON_STATS = 'on_stats';
179
180    /**
181     * progress: (callable) Defines a function to invoke when transfer
182     * progress is made. The function accepts the following positional
183     * arguments: the total number of bytes expected to be downloaded, the
184     * number of bytes downloaded so far, the number of bytes expected to be
185     * uploaded, the number of bytes uploaded so far.
186     */
187    public const PROGRESS = 'progress';
188
189    /**
190     * proxy: (string|array) Pass a string to specify an HTTP proxy, or an
191     * array to specify different proxies for different protocols (where the
192     * key is the protocol and the value is a proxy string).
193     */
194    public const PROXY = 'proxy';
195
196    /**
197     * query: (array|string) Associative array of query string values to add
198     * to the request. This option uses PHP's http_build_query() to create
199     * the string representation. Pass a string value if you need more
200     * control than what this method provides
201     */
202    public const QUERY = 'query';
203
204    /**
205     * sink: (resource|string|StreamInterface) Where the data of the
206     * response is written to. Defaults to a PHP temp stream. Providing a
207     * string will write data to a file by the given name.
208     */
209    public const SINK = 'sink';
210
211    /**
212     * synchronous: (bool) Set to true to inform HTTP handlers that you intend
213     * on waiting on the response. This can be useful for optimizations. Note
214     * that a promise is still returned if you are using one of the async
215     * client methods.
216     */
217    public const SYNCHRONOUS = 'synchronous';
218
219    /**
220     * ssl_key: (array|string) Specify the path to a file containing a private
221     * SSL key in PEM format. If a password is required, then set to an array
222     * containing the path to the SSL key in the first array element followed
223     * by the password required for the certificate in the second element.
224     */
225    public const SSL_KEY = 'ssl_key';
226
227    /**
228     * stream: Set to true to attempt to stream a response rather than
229     * download it all up-front.
230     */
231    public const STREAM = 'stream';
232
233    /**
234     * verify: (bool|string, default=true) Describes the SSL certificate
235     * verification behavior of a request. Set to true to enable SSL
236     * certificate verification using the system CA bundle when available
237     * (the default). Set to false to disable certificate verification (this
238     * is insecure!). Set to a string to provide the path to a CA bundle on
239     * disk to enable verification using a custom certificate.
240     */
241    public const VERIFY = 'verify';
242
243    /**
244     * timeout: (float, default=0) Float describing the timeout of the
245     * request in seconds. Use 0 to wait indefinitely (the default behavior).
246     */
247    public const TIMEOUT = 'timeout';
248
249    /**
250     * read_timeout: (float, default=default_socket_timeout ini setting) Float describing
251     * the body read timeout, for stream requests.
252     */
253    public const READ_TIMEOUT = 'read_timeout';
254
255    /**
256     * version: (float) Specifies the HTTP protocol version to attempt to use.
257     */
258    public const VERSION = 'version';
259
260    /**
261     * force_ip_resolve: (bool) Force client to use only ipv4 or ipv6 protocol
262     */
263    public const FORCE_IP_RESOLVE = 'force_ip_resolve';
264}
265