Diactoros
Table of Contents
Namespaces
Classes
- AbstractSerializer
- Provides base functionality for request and response de/serialization strategies, including functionality for retrieving a line at a time from the message, splitting headers from the body, and serializing headers.
- CallbackStream
- Implementation of PSR HTTP streams
- ConfigProvider
- HeaderSecurity
- Provide security tools around HTTP headers to prevent common injection vectors.
- Module
- PhpInputStream
- Caching version of php://input
- RelativeStream
- Wrapper for default Stream class, representing subpart (starting from given offset) of initial stream.
- Request
- HTTP Request encapsulation
- RequestFactory
- Response
- HTTP response encapsulation.
- ResponseFactory
- ServerRequest
- Server-side HTTP request
- ServerRequestFactory
- Class for marshaling a request object from the current PHP environment.
- Stream
- Implementation of PSR HTTP streams
- StreamFactory
- UploadedFile
- UploadedFileFactory
- Uri
- Implementation of Psr\Http\UriInterface.
- UriFactory
Traits
- MessageTrait
- Trait implementing the various methods defined in MessageInterface.
- RequestTrait
- Trait with common request behaviors.
Functions
- createUploadedFile() : UploadedFile
- Create an uploaded file instance from an array of values.
- marshalHeadersFromSapi() : array<string|int, mixed>
- marshalMethodFromSapi() : string
- Retrieve the request method from the SAPI parameters.
- marshalProtocolVersionFromSapi() : string
- Return HTTP protocol version (X.Y) as discovered within a `$_SERVER` array.
- marshalUriFromSapi() : Uri
- Marshal a Uri instance based on the values presnt in the $_SERVER array and headers.
- normalizeServer() : array<string|int, mixed>
- Marshal the $_SERVER array
- normalizeUploadedFiles() : array<string|int, UploadedFileInterface>
- Normalize uploaded files
- parseCookieHeader() : array<non-empty-string, string>
- Parse a cookie header according to RFC 6265.
Functions
createUploadedFile()
Create an uploaded file instance from an array of values.
createUploadedFile(array<string|int, mixed> $spec) : UploadedFile
Parameters
- $spec : array<string|int, mixed>
-
A single $_FILES entry.
Tags
Return values
UploadedFilemarshalHeadersFromSapi()
marshalHeadersFromSapi(array<string|int, mixed> $server) : array<string|int, mixed>
Parameters
- $server : array<string|int, mixed>
-
Values obtained from the SAPI (generally
$_SERVER
).
Return values
array<string|int, mixed> —Header/value pairs
marshalMethodFromSapi()
Retrieve the request method from the SAPI parameters.
marshalMethodFromSapi(array<string|int, mixed> $server) : string
Parameters
- $server : array<string|int, mixed>
Return values
stringmarshalProtocolVersionFromSapi()
Return HTTP protocol version (X.Y) as discovered within a `$_SERVER` array.
marshalProtocolVersionFromSapi(array<string|int, mixed> $server) : string
Parameters
- $server : array<string|int, mixed>
Tags
Return values
stringmarshalUriFromSapi()
Marshal a Uri instance based on the values presnt in the $_SERVER array and headers.
This function is deprecated as of 2.11.1, and will be removed in 3.0.0. As of 2.11.1, it is no longer used internally.
marshalUriFromSapi(array<string|int, mixed> $server, array<string|int, mixed> $headers) : Uri
Parameters
- $server : array<string|int, mixed>
-
SAPI parameters
- $headers : array<string|int, mixed>
-
HTTP request headers
Return values
UrinormalizeServer()
Marshal the $_SERVER array
normalizeServer(array<string|int, mixed> $server[, null|callable $apacheRequestHeaderCallback = null ]) : array<string|int, mixed>
Pre-processes and returns the $_SERVER superglobal. In particularly, it attempts to detect the Authorization header, which is often not aggregated correctly under various SAPI/httpd combinations.
Parameters
- $server : array<string|int, mixed>
- $apacheRequestHeaderCallback : null|callable = null
-
Callback that can be used to retrieve Apache request headers. This defaults to
apache_request_headers
under the Apache mod_php.
Return values
array<string|int, mixed> —Either $server verbatim, or with an added HTTP_AUTHORIZATION header.
normalizeUploadedFiles()
Normalize uploaded files
normalizeUploadedFiles(array<string|int, mixed> $files) : array<string|int, UploadedFileInterface>
Transforms each value into an UploadedFile instance, and ensures that nested arrays are normalized.
Parameters
- $files : array<string|int, mixed>
Tags
Return values
array<string|int, UploadedFileInterface>parseCookieHeader()
Parse a cookie header according to RFC 6265.
parseCookieHeader(string $cookieHeader) : array<non-empty-string, string>
PHP will replace special characters in cookie names, which results in other cookies not being available due to overwriting. Thus, the server request should take the cookies from the request header instead.
Parameters
- $cookieHeader : string
-
A string cookie header value.
Return values
array<non-empty-string, string> —key/value cookie pairs.