|
1 | 1 | # chillerlan/php-httpinterface |
2 | 2 |
|
3 | | -A http client wrapper/PSR-7/PSR-17/PSR-18 implementation for PHP 7.2+. |
| 3 | +A [PSR-7](https://www.php-fig.org/psr/psr-7/)/[PSR-17](https://www.php-fig.org/psr/psr-17/)/[PSR-18](https://www.php-fig.org/psr/psr-18/) implementation for PHP 7.2+. |
4 | 4 |
|
5 | 5 | [![version][packagist-badge]][packagist] |
6 | 6 | [![license][license-badge]][license] |
@@ -81,11 +81,26 @@ $http->request('https://www.example.com', $http::METHOD_GET, ['foo' => 'bar']); |
81 | 81 | ``` |
82 | 82 | Both methods will return a PSR-7 `ResponseInterface`. |
83 | 83 |
|
84 | | -### PSR-7 Message helpers |
85 | | -These static methods can be found in the `chillerlan\HTTP\Psr7` namespace |
86 | | - |
87 | | - |
88 | | -### PSR-17 Factory helpers |
| 84 | +### [PSR-7](https://www.php-fig.org/psr/psr-7/) Message helpers |
| 85 | +These static methods can be found in the `chillerlan\HTTP\Psr7` namespace: |
| 86 | + |
| 87 | +- `normalize_request_headers(array $headers)` |
| 88 | +- `r_rawurlencode($data)` - recursive rawurlencode, accepts a string or an array as input |
| 89 | +- `build_http_query(array $params, bool $urlencode = null, string $delimiter = null, string $enclosure = null)` - see [abraham/twitteroauth](https://github.com/abraham/twitteroauth/blob/master/src/Util.php#L82) |
| 90 | +- `clean_query_params(iterable $params, int $bool_cast = null, bool $remove_empty = null)` - clean an array of parameters for URL queries (or JSON output etc.) using the following cast formats: |
| 91 | + - `BOOLEANS_AS_BOOL` - bool types will be left untouched (default) |
| 92 | + - `BOOLEANS_AS_INT` - cast to integer `1` and `0` |
| 93 | + - `BOOLEANS_AS_STRING` - a string value `"true"` and `"false"` |
| 94 | + - `BOOLEANS_AS_INT_STRING` - integer values, but as string, `"1"` and `"0"` |
| 95 | +- `merge_query(string $uri, array $query)` - merges an array of parameters into an URL query string |
| 96 | +- `normalize_files(array $files)` |
| 97 | +- `create_uploaded_file_from_spec(array $value)` |
| 98 | +- `normalize_nested_file_spec(array $files = [])` |
| 99 | +- `get_json(ResponseInterface $response, bool $assoc = null)` |
| 100 | +- `get_xml(ResponseInterface $response)` |
| 101 | +- `message_to_string(MessageInterface $message)` - returns the string representation of a `MessageInterface` |
| 102 | + |
| 103 | +### [PSR-17](https://www.php-fig.org/psr/psr-17/) Factory helpers |
89 | 104 | These static methods can be found in the `chillerlan\HTTP\Psr17` namespace: |
90 | 105 |
|
91 | 106 | - `create_server_request_from_globals()` - creates a PSR-7 `ServerRequestInterface` object that is populated with the GPCS superglobals. |
|
0 commit comments