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