Skip to content

Commit 4aab0f9

Browse files
committed
:octocat:
1 parent be173f3 commit 4aab0f9

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,15 @@ The following classes contain static methods for use with PSR-7 http message obj
6767
| `recursiveRawurlencode(mixed $data)` | `array\|string` | Recursive [`rawurlencode`](https://www.php.net/manual/en/function.rawurlencode) |
6868

6969
### `MessageUtil`
70-
| method | return | info |
71-
|-------------------------------------------------------------|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
72-
| `getContents(MessageInterface $message)` | `string` | Reads the body content of a `MessageInterface` and makes sure to rewind. |
73-
| `decodeJSON(MessageInterface $message, bool $assoc = null)` | mixed | fetches the body of a `MessageInterface` and converts it to a JSON object (`stdClass`) or an associative array if `$assoc` is set to `true` and returns the result. |
74-
| `decodeXML(MessageInterface $message, bool $assoc = null)` | mixed | fetches the body of a `MessageInterface` and converts it to a `SimpleXMLElement` or an associative array if `$assoc` is set to `true` and returns the result. |
75-
| `toString(MessageInterface $message)` | `string` | Returns the string representation of an HTTP message. |
76-
| `decompress(MessageInterface $message)` | `string` | Decompresses the message content according to the `Content-Encoding` header (`compress`, `deflate`, `gzip`, `br`, `zstd`) and returns the decompressed data. `br` and `zstd` will throw a `RuntimeException` if the respecive extensions are missing. |
77-
| `setContentLengthHeader(MessageInterface $message)` | `MessageInterface` | ets a Content-Length header in the given message in case it does not exist and body size is not null |
70+
| method | return | info |
71+
|------------------------------------------------------------------------------------------------------|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
72+
| `getContents(MessageInterface $message)` | `string` | Reads the body content of a `MessageInterface` and makes sure to rewind. |
73+
| `decodeJSON(MessageInterface $message, bool $assoc = null)` | mixed | fetches the body of a `MessageInterface` and converts it to a JSON object (`stdClass`) or an associative array if `$assoc` is set to `true` and returns the result. |
74+
| `decodeXML(MessageInterface $message, bool $assoc = null)` | mixed | fetches the body of a `MessageInterface` and converts it to a `SimpleXMLElement` or an associative array if `$assoc` is set to `true` and returns the result. |
75+
| `toString(MessageInterface $message)` | `string` | Returns the string representation of an HTTP message. |
76+
| `decompress(MessageInterface $message)` | `string` | Decompresses the message content according to the `Content-Encoding` header (`compress`, `deflate`, `gzip`, `br`, `zstd`) and returns the decompressed data. `br` and `zstd` will throw a `RuntimeException` if the respecive extensions are missing. |
77+
| `setContentLengthHeader(MessageInterface $message)` | `MessageInterface` | Sets a Content-Length header in the given message in case it does not exist and body size is not null |
78+
| `setContentTypeHeader(MessageInterface $message, string $filename = null, string $extension = null)` | `MessageInterface` | Tries to determine the content type from the given values and sets the Content-Type header accordingly, throws if no mime type could be guessed. |
7879

7980
### `UriUtil`
8081
| method | return | info |
@@ -94,6 +95,11 @@ The following classes contain static methods for use with PSR-7 http message obj
9495
| `getFromFilename(string $filename)` | `?string` | Get the mime type from a file name |
9596
| `getFromContent(string $content)` | `?string` | Get the mime type from the given content |
9697

98+
### `StreamUtil`
99+
| method | return | info |
100+
|----------------------------------|----------|---------------------------------------------------------|
101+
| `getContents(string $extension)` | `string` | Reads the content from a stream and make sure we rewind |
102+
97103
### `ServerUtil`
98104
The `ServerUtil` object requires a set of [PSR-17 factories](https://www.php-fig.org/psr/psr-17/) on invocation, namely `ServerRequestFactoryInterface`, `UriFactoryInterface`, `UploadedFileFactoryInterface` and `StreamFactoryInterface`.
99105
It provides convenience methods to create server requests, URIs and uploaded files from the [superglobals](https://www.php.net/manual/en/language.variables.superglobals.php).

0 commit comments

Comments
 (0)