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