Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit c5b2634

Browse files
committed
Documents new functions introduced in #307
1 parent 4c44c74 commit c5b2634

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

doc/book/api.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,31 @@ $request = RequestFactory::fromGlobals(
128128
);
129129
```
130130

131+
### ServerRequestFactory helper functions
132+
133+
- Since 1.8.0
134+
135+
In order to create the various artifacts required by a `ServerRequest` instance,
136+
Diactoros also provides a number of functions under the `Zend\Diactoros`
137+
namespace for introspecting the SAPI `$_SERVER` parameters, headers, `$_FILES`,
138+
and even the `Cookie` header. These include:
139+
140+
- `Zend\Diactoros\normalizeServer(array $server, callable $apacheRequestHeaderCallback = null) : array`
141+
(its main purpose is to aggregate the `Authorization` header in the SAPI params
142+
when under Apache)
143+
- `Zend\Diactoros\marshalProtocolVersionFromSapi(array $server) : string`
144+
- `Zend\Diactoros\marshalMethodFromSapi(array $server) : string`
145+
- `Zend\Diactoros\marshalUriFromSapi(array $server, array $headers) : Uri`
146+
- `Zend\Diactoros\marshalHeadersFromSapi(array $server) : array`
147+
- `Zend\Diactoros\parseCookieHeader(string $header) : array`
148+
- `Zend\Diactoros\createUploadedFile(array $spec) : UploadedFile` (creates the
149+
instance from a normal `$_FILES` entry)
150+
- `Zend\Diactoros\normalizeUploadedFiles(array $files) : UploadedFileInterface[]`
151+
(traverses a potentially nested array of uploaded file instances and/or
152+
`$_FILES` entries, including those aggregated under mod_php, php-fpm, and
153+
php-cgi in order to create a flat array of `UploadedFileInterface` instances
154+
to use in a request)
155+
131156
## URI
132157

133158
`Zend\Diactoros\Uri` is an implementation of

0 commit comments

Comments
 (0)