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