class PsrHttpFactory implements ServerRequestFactoryInterface, RequestFactoryInterface, ResponseFactoryInterface, UriFactoryInterface, StreamFactoryInterface, UploadedFileFactoryInterface (View source)

A factory that implements all interfaces of PSR 17

This factory can be used to simply create Requests, Uris and Streams without having to inject the traits yourself.

Traits

Properties

protected UriFactoryInterface $uriFactory from  ServerRequestFactoryTrait
protected string $defaultUserAgent from  ServerRequestFactoryTrait
protected string $scriptPath from  ServerRequestFactoryTrait
protected string $defaultHttpVersion from  ServerRequestFactoryTrait

Methods

__construct(UriFactoryInterface $uriFactory, string $defaultUserAgent = 'Flow/' . FLOW_VERSION_BRANCH, string $scriptPath = 'index.php', string $defaultHttpVersion = '1.1')

ServerRequestFactory constructor.

ServerRequestInterface
createServerRequest(string $method, $uri, array $serverParams = [])

No description

RequestInterface
createRequest(string $method, $uri)

No description

ResponseInterface
createResponse(int $code = 200, string $reasonPhrase = '')

No description

UriInterface
createUri(string $uri = '')

No description

StreamInterface
createStream(string $content = '')

No description

StreamInterface
createStreamFromFile(string $filename, string $mode = 'r')

No description

StreamInterface
createStreamFromResource($resource)

No description

UploadedFileInterface
createUploadedFile(StreamInterface $stream, int $size = null, int $error = \UPLOAD_ERR_OK, string $clientFilename = null, string $clientMediaType = null)

No description

Details

__construct(UriFactoryInterface $uriFactory, string $defaultUserAgent = 'Flow/' . FLOW_VERSION_BRANCH, string $scriptPath = 'index.php', string $defaultHttpVersion = '1.1')

ServerRequestFactory constructor.

Parameters

UriFactoryInterface $uriFactory
string $defaultUserAgent
string $scriptPath
string $defaultHttpVersion

ServerRequestInterface createServerRequest(string $method, $uri, array $serverParams = [])

No description

Parameters

string $method
$uri
array $serverParams

Return Value

ServerRequestInterface

RequestInterface createRequest(string $method, $uri)

No description

Parameters

string $method
$uri

Return Value

RequestInterface

ResponseInterface createResponse(int $code = 200, string $reasonPhrase = '')

No description

Parameters

int $code
string $reasonPhrase

Return Value

ResponseInterface

UriInterface createUri(string $uri = '')

No description

Parameters

string $uri

Return Value

UriInterface

StreamInterface createStream(string $content = '')

No description

Parameters

string $content

Return Value

StreamInterface

StreamInterface createStreamFromFile(string $filename, string $mode = 'r')

No description

Parameters

string $filename
string $mode

Return Value

StreamInterface

StreamInterface createStreamFromResource($resource)

No description

Parameters

$resource

Return Value

StreamInterface

UploadedFileInterface createUploadedFile(StreamInterface $stream, int $size = null, int $error = \UPLOAD_ERR_OK, string $clientFilename = null, string $clientMediaType = null)

No description

Parameters

StreamInterface $stream
int $size
int $error
string $clientFilename
string $clientMediaType

Return Value

UploadedFileInterface