RequestFactory
in package
implements
RequestFactoryInterface, ServerRequestFactoryInterface
Factory for Client and Server representations of a HTTP request object
Request is intended to be sent by a HTTP client.
ServerRequest is intended to be used in a server side request handler stack
Interfaces, Classes, Traits and Enums
- RequestFactoryInterface
- ServerRequestFactoryInterface
Table of Contents
- createRequest() : RequestInterface
- Create a new request.
- createServerRequest() : ServerRequestInterface
- Create a new server request.
Methods
createRequest()
Create a new request.
public
createRequest(string $method, UriInterface|string $uri) : RequestInterface
Parameters
- $method : string
-
The HTTP method associated with the request.
- $uri : UriInterface|string
-
The URI associated with the request. If the value is a string, the factory MUST create a UriInterface instance based on it.
Return values
RequestInterface —createServerRequest()
Create a new server request.
public
createServerRequest(string $method, UriInterface|string $uri[, array<string|int, mixed> $serverParams = [] ]) : ServerRequestInterface
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 : string
-
The HTTP method associated with the request.
- $uri : UriInterface|string
-
The URI associated with the request. If the value is a string, the factory MUST create a UriInterface instance based on it.
- $serverParams : array<string|int, mixed> = []
-
Array of SAPI parameters with which to seed the generated request instance.