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

Commit

Permalink
Documents new functions introduced in #307
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Jun 27, 2018
1 parent 4c44c74 commit c5b2634
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions doc/book/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,31 @@ $request = RequestFactory::fromGlobals(
);
```

### ServerRequestFactory helper functions

- Since 1.8.0

In order to create the various artifacts required by a `ServerRequest` instance,
Diactoros also provides a number of functions under the `Zend\Diactoros`
namespace for introspecting the SAPI `$_SERVER` parameters, headers, `$_FILES`,
and even the `Cookie` header. These include:

- `Zend\Diactoros\normalizeServer(array $server, callable $apacheRequestHeaderCallback = null) : array`
(its main purpose is to aggregate the `Authorization` header in the SAPI params
when under Apache)
- `Zend\Diactoros\marshalProtocolVersionFromSapi(array $server) : string`
- `Zend\Diactoros\marshalMethodFromSapi(array $server) : string`
- `Zend\Diactoros\marshalUriFromSapi(array $server, array $headers) : Uri`
- `Zend\Diactoros\marshalHeadersFromSapi(array $server) : array`
- `Zend\Diactoros\parseCookieHeader(string $header) : array`
- `Zend\Diactoros\createUploadedFile(array $spec) : UploadedFile` (creates the
instance from a normal `$_FILES` entry)
- `Zend\Diactoros\normalizeUploadedFiles(array $files) : UploadedFileInterface[]`
(traverses a potentially nested array of uploaded file instances and/or
`$_FILES` entries, including those aggregated under mod_php, php-fpm, and
php-cgi in order to create a flat array of `UploadedFileInterface` instances
to use in a request)

## URI

`Zend\Diactoros\Uri` is an implementation of
Expand Down

0 comments on commit c5b2634

Please sign in to comment.