Debian Codegraph @

vendor/guzzlehttp/guzzle/src/RequestOptions.php

raw
1 <?php
2
3 namespace GuzzleHttp;
4
5 /**
6 * This class contains a list of built-in Guzzle request options.
7 *
8 * @see https://github.com/guzzle/guzzle/blob/7.13/docs/request-options.md
9 */
10 final class RequestOptions
11 {
12 /**
13 * allow_redirects: (bool|array) Controls redirect behavior. Pass false
14 * to disable redirects, pass true to enable redirects, pass an
15 * associative to provide custom redirect settings. Defaults to "false".
16 * This option only works if your handler has the RedirectMiddleware. When
17 * passing an associative array, you can provide the following key value
18 * pairs:
19 *
20 * - max: (int, default=5) maximum number of allowed redirects.
21 * - strict: (bool, default=false) Set to true to use strict redirects
22 * meaning redirect POST requests with POST requests vs. doing what most
23 * browsers do which is redirect POST requests with GET requests. The
24 * QUERY method keeps its method and body across non-strict 301 and 302
25 * redirects, and a 303 redirect is followed with a body-less GET.
26 * - referer: (bool, default=false) Set to true to enable the Referer
27 * header.
28 * - protocols: (non-empty-array<array-key, string>, default=['http', 'https'])
29 * Allowed redirect protocols. Redirect matching is case-sensitive; use
30 * "http" and "https".
31 * - on_redirect: (callable) PHP callable that is invoked when a redirect
32 * is encountered. The callable is invoked with the request, the redirect
33 * response that was received, and the effective URI. Any return value
34 * from the on_redirect function is ignored.
35 * - track_redirects: (bool, default=false) Track redirected URI and status
36 * history in response headers.
37 */
38 public const ALLOW_REDIRECTS = 'allow_redirects';
39
40 /**
41 * auth: (array{0: string, 1: string, 2?: string|null}|string|false|null)
42 * Pass an array of HTTP authentication parameters to use with the request.
43 * The array must contain the username in index [0], the password in index
44 * [1], and you can optionally provide a built-in authentication type in
45 * index [2]. Pass false or null to disable authentication for a request.
46 * String values are passed through for custom handlers.
47 */
48 public const AUTH = 'auth';
49
50 /**
51 * body: (resource|string|null|int|float|bool|\Psr\Http\Message\StreamInterface|(callable&object)|\Iterator|\Stringable)
52 * Body to send in the request. Callable arrays are arrays, and arrays are
53 * not valid body values in Guzzle.
54 */
55 public const BODY = 'body';
56
57 /**
58 * cert: (string|array{0: string, 1?: string|null}) Set to a string to
59 * specify the path to a client certificate file. PEM is the default
60 * certificate format. If a password is required, set cert to an array
61 * containing the certificate path in the first array element followed by
62 * the certificate password in the second array element. A null password is
63 * treated the same as omitting it. Use cert_type to specify another
64 * supported certificate format.
65 */
66 public const CERT = 'cert';
67
68 /**
69 * cert_type: (string) Specify the SSL client certificate file type.
70 */
71 public const CERT_TYPE = 'cert_type';
72
73 /**
74 * cookies: (false|GuzzleHttp\Cookie\CookieJarInterface, default=false)
75 * Specifies whether or not cookies are used in a request or what cookie
76 * jar to use or what cookies to send. This option only works if your
77 * handler has the `cookie` middleware. Valid values are `false` and
78 * an instance of {@see Cookie\CookieJarInterface}.
79 */
80 public const COOKIES = 'cookies';
81
82 /**
83 * connect_timeout: (int|float, default=0) Number of seconds to wait while
84 * trying to connect to a server. Use 0 to wait 300 seconds (the default
85 * behavior).
86 */
87 public const CONNECT_TIMEOUT = 'connect_timeout';
88
89 /**
90 * crypto_method: (int) A value describing the minimum TLS protocol
91 * version to use.
92 *
93 * This setting must be set to one of the
94 * ``STREAM_CRYPTO_METHOD_TLS*_CLIENT`` constants. PHP 7.4 or higher is
95 * required in order to use TLS 1.3, and cURL 7.34.0 or higher is required
96 * in order to specify a crypto method, with cURL 7.52.0 or higher being
97 * required to use TLS 1.3.
98 */
99 public const CRYPTO_METHOD = 'crypto_method';
100
101 /**
102 * crypto_method_max: (int) A value describing the maximum TLS protocol
103 * version to use.
104 *
105 * This setting must be set to one of the
106 * ``STREAM_CRYPTO_METHOD_TLS*_CLIENT`` constants. On the stream handler,
107 * PHP 7.3 or higher is required to set a maximum TLS version, and PHP 7.4
108 * or higher is required to use TLS 1.3. cURL 7.54.0 or higher is required
109 * in order to specify a maximum TLS version with the cURL handler.
110 */
111 public const CRYPTO_METHOD_MAX = 'crypto_method_max';
112
113 /**
114 * curl: (array) Raw cURL options to apply when using a built-in cURL handler.
115 */
116 public const CURL = 'curl';
117
118 /**
119 * debug: (bool|resource) Set to true or set to a PHP stream returned by
120 * fopen() enable debug output with the HTTP handler used to send a
121 * request.
122 */
123 public const DEBUG = 'debug';
124
125 /**
126 * decode_content: (bool|string, default=true) Specify whether or not
127 * Content-Encoding responses (gzip, deflate, etc.) are automatically
128 * decoded.
129 */
130 public const DECODE_CONTENT = 'decode_content';
131
132 /**
133 * delay: (int|float) The amount of time to delay before sending in
134 * milliseconds.
135 */
136 public const DELAY = 'delay';
137
138 /**
139 * expect: (bool|integer) Controls the behavior of the
140 * "Expect: 100-Continue" header.
141 *
142 * Set to `true` to enable the "Expect: 100-Continue" header for all
143 * requests that sends a body. Set to `false` to disable the
144 * "Expect: 100-Continue" header for all requests. Set to a number so that
145 * the size of the payload must be greater than the number in order to send
146 * the Expect header. Setting to a number will send the Expect header for
147 * all requests in which the size of the payload cannot be determined or
148 * where the body is not rewindable.
149 *
150 * By default, Guzzle will add the "Expect: 100-Continue" header when the
151 * size of the body of a request is greater than 1 MB and a request is
152 * using HTTP/1.1.
153 */
154 public const EXPECT = 'expect';
155
156 /**
157 * form_params: (array<array-key, string|int|float|bool|null|array>)
158 * Associative array of form field names to scalar, null, or nested array
159 * values. Sets the Content-Type header to application/x-www-form-urlencoded
160 * when no Content-Type header is already present.
161 */
162 public const FORM_PARAMS = 'form_params';
163
164 /**
165 * headers: (array<array-key, string|non-empty-array<array-key, string>>|null)
166 * Associative array of HTTP headers. Each value MUST be a string or non-empty
167 * array of strings.
168 */
169 public const HEADERS = 'headers';
170
171 /**
172 * http_errors: (bool, default=true) Set to false to disable exceptions
173 * when a non- successful HTTP response is received. By default,
174 * exceptions will be thrown for 4xx and 5xx responses. This option only
175 * works if your handler has the `httpErrors` middleware.
176 */
177 public const HTTP_ERRORS = 'http_errors';
178
179 /**
180 * idn_conversion: (bool|int|null, default=false) A combination of IDNA_*
181 * constants for PHP's idn_to_ascii() function. Set to false or null to
182 * disable IDN support, or to true to use the default configuration
183 * (IDNA_DEFAULT constant).
184 */
185 public const IDN_CONVERSION = 'idn_conversion';
186
187 /**
188 * json: (mixed) Adds JSON data to a request. The provided value is JSON
189 * encoded and a Content-Type header of application/json will be added to
190 * the request if no Content-Type header is already present.
191 */
192 public const JSON = 'json';
193
194 /**
195 * multipart: (array) Array of part arrays, each containing a required
196 * "name" key mapping to the string or integer form field name, a required
197 * "contents" key mapping to any non-array value accepted by PSR-7
198 * Utils::streamFor() or a nested array of field values, an optional
199 * "headers" array of string custom header values, and an optional
200 * "filename" key mapping to a string to send as the filename in the part.
201 * "headers" and "filename" cannot be used when "contents" is an array.
202 */
203 public const MULTIPART = 'multipart';
204
205 /**
206 * on_headers: (callable) A callable that is invoked when the HTTP headers
207 * of the response have been received but the body has not yet begun to
208 * download.
209 */
210 public const ON_HEADERS = 'on_headers';
211
212 /**
213 * on_stats: (callable) allows you to get access to transfer statistics of
214 * a request and access the lower level transfer details of the handler
215 * associated with your client. ``on_stats`` is a callable that is invoked
216 * when a handler has finished sending a request. The callback is invoked
217 * with transfer statistics about the request, the response received, or
218 * the error encountered. Included in the data is the total amount of time
219 * taken to send the request.
220 */
221 public const ON_STATS = 'on_stats';
222
223 /**
224 * progress: (callable) Defines a function to invoke when transfer
225 * progress is made. The function accepts the following positional
226 * arguments: the total number of bytes expected to be downloaded, the
227 * number of bytes downloaded so far, the number of bytes expected to be
228 * uploaded, the number of bytes uploaded so far.
229 */
230 public const PROGRESS = 'progress';
231
232 /**
233 * protocols: (non-empty-array<array-key, string>, default=['http', 'https'])
234 * Allowed URI schemes. Built-in handlers accept only the case-sensitive
235 * values "http" and "https".
236 */
237 public const PROTOCOLS = 'protocols';
238
239 /**
240 * proxy: (string|array) Pass a string to specify an HTTP proxy, or an
241 * array to specify different proxies for different protocols (where the
242 * key is the protocol and the value is a proxy string or null). Provide a
243 * "no" key as a comma-delimited string, array of strings, or null to
244 * specify hosts or host-and-port pairs that should not be proxied.
245 */
246 public const PROXY = 'proxy';
247
248 /**
249 * query: (array<array-key, mixed>|string) Associative array of query string
250 * values to add to the request. This option uses PHP's http_build_query()
251 * to create the string representation. Pass a string value if you need
252 * more control than what this method provides
253 */
254 public const QUERY = 'query';
255
256 /**
257 * sink: (resource|string|\Psr\Http\Message\StreamInterface) Where the data
258 * of the response is written to. Defaults to a PHP temp stream. Providing
259 * a string will write data to a file by the given name.
260 */
261 public const SINK = 'sink';
262
263 /**
264 * synchronous: (bool) Set to true to inform HTTP handlers that you intend
265 * on waiting on the response. This can be useful for optimizations. Note
266 * that a promise is still returned if you are using one of the async
267 * client methods.
268 */
269 public const SYNCHRONOUS = 'synchronous';
270
271 /**
272 * ssl_key: (array{0: string, 1?: string|null}|string) Specify the path to
273 * a private SSL key file. PEM is the default private key format. If a
274 * password is required, set ssl_key to an array containing the key path in
275 * the first array element followed by the key password in the second
276 * element. A null password is treated the same as omitting it. Use
277 * ssl_key_type to specify another supported key format.
278 */
279 public const SSL_KEY = 'ssl_key';
280
281 /**
282 * ssl_key_type: (string) Specify the SSL private key file type.
283 */
284 public const SSL_KEY_TYPE = 'ssl_key_type';
285
286 /**
287 * stream: (bool) Set to true to attempt to stream a response rather than
288 * download it all up-front.
289 */
290 public const STREAM = 'stream';
291
292 /**
293 * stream_context: (array) PHP stream context options to merge into the
294 * context used by the built-in stream handler.
295 */
296 public const STREAM_CONTEXT = 'stream_context';
297
298 /**
299 * verify: (bool|string, default=true) Describes the SSL certificate
300 * verification behavior of a request. Set to true to enable SSL
301 * certificate verification using the system CA bundle when available
302 * (the default). Set to false to disable certificate verification (this
303 * is insecure!). Set to a string to provide the path to a CA bundle on
304 * disk to enable verification using a custom certificate.
305 */
306 public const VERIFY = 'verify';
307
308 /**
309 * timeout: (int|float, default=0) Number describing the timeout of the
310 * request in seconds. Use 0 to wait indefinitely (the default behavior).
311 */
312 public const TIMEOUT = 'timeout';
313
314 /**
315 * read_timeout: (int|float, default=default_socket_timeout ini setting)
316 * Number describing the body read timeout, for stream requests.
317 */
318 public const READ_TIMEOUT = 'read_timeout';
319
320 /**
321 * retries: (int) Current retry count used by the retry middleware.
322 */
323 public const RETRIES = 'retries';
324
325 /**
326 * version: (string|int|float) Specifies the HTTP protocol version to attempt
327 * to use.
328 */
329 public const VERSION = 'version';
330
331 /**
332 * force_ip_resolve: (string) Set to "v4" to force IPv4 resolution or "v6"
333 * for IPv6 resolution when supported by the handler.
334 */
335 public const FORCE_IP_RESOLVE = 'force_ip_resolve';
336 }