Methods |
public
|
createRequest(string $method, $uri): RequestInterface
Create a new request.
Parameters
$method |
The HTTP method associated with the request.
|
$uri |
The URI associated with the request. If
the value is a string, the factory MUST create a UriInterface
instance based on it.
|
Implements
|
#
|
public
|
createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
Create a new response.
Parameters
$code |
HTTP status code; defaults to 200
|
$reasonPhrase |
Reason phrase to associate with status code
in generated response; if none is provided implementations MAY use
the defaults as suggested in the HTTP specification.
|
Implements
|
#
|
public
|
createServerRequest(string $method, $uri, mixed[] $serverParams = []): ServerRequestInterface
Create a new server request.
Create a new server request.
Note that server-params are taken precisely as given - no parsing/processing
of the given values is performed, and, in particular, no attempt is made to
determine the HTTP method or URI, which must be provided explicitly.
Parameters
$method |
The HTTP method associated with the request.
|
$uri |
The URI associated with the request. If
the value is a string, the factory MUST create a UriInterface
instance based on it.
|
$serverParams |
Array of SAPI parameters with which to seed
the generated request instance.
|
Implements
|
#
|
public
|
createStream(string $content = ''): StreamInterface
Create a new stream from a string.
Create a new stream from a string.
The stream SHOULD be created with a temporary resource.
Parameters
$content |
String content with which to populate the stream.
|
Implements
|
#
|
public
|
createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface
Create a stream from an existing file.
Create a stream from an existing file.
The file MUST be opened using the given mode, which may be any mode
supported by the fopen function.
The $filename MAY be any string supported by fopen() .
Parameters
$filename |
Filename or stream URI to use as basis of stream.
|
$mode |
Mode with which to open the underlying filename/stream.
|
Implements
|
#
|
public
|
createStreamFromResource($resource): StreamInterface
Create a new stream from an existing resource.
Create a new stream from an existing resource.
The stream MUST be readable and may be writable.
Parameters
$resource |
PHP resource to use as basis of stream.
|
Implements
|
#
|
public
|
createUploadedFile(
StreamInterface $stream,
?int $size = null,
int $error = UPLOAD_ERR_OK,
?string $clientFilename = null,
?string $clientMediaType = null,
): UploadedFileInterface
Create a new uploaded file.
Create a new uploaded file.
If a size is not provided it will be determined by checking the size of
the file.
Parameters
$stream |
Underlying stream representing the
uploaded file content.
|
$size |
in bytes
|
$error |
PHP file upload error
|
$clientFilename |
Filename as provided by the client, if any.
|
$clientMediaType |
Media type as provided by the client, if any.
|
Implements
|
#
|
public
|
createUri(string $uri = ''): UriInterface
Create a new URI.
|
#
|