Skip to content

ServerRequestFactory: createServerRequest Example

Terry L edited this page Jun 21, 2020 · 6 revisions
Clone this wiki locally


createServerRequest($method, $uri, $serverParams)

Create a new server request.

  • param string method *The HTTP method associated with the request.
  • param UriInterface|string uri *The URI associated with the request.
  • param array serverParams = [] An array of Server API (SAPI) parameters with which to seed the generated request instance.
  • return ServerRequestInterface


$serverRequestFactory = new ServerRequestFactory();

$method = 'GET';
$url = '';

$serverRequest = $serverRequestFactory->createServerRequest($method, $uri);