-
Notifications
You must be signed in to change notification settings - Fork 1
PSR 17: ServerRequestFactory Example
Terry L edited this page Jun 18, 2020
·
2 revisions
- createServerRequest
-
::fromGlobal
(Non-PSR)
None
Example:
use Shieldon\Psr17\ServerRequestFactory;
$serverRequestFactory = new ServerRequestFactory();-
param
stringmethod*The HTTP method associated with the request. -
param
UriInterface|stringuri*The URI associated with the request. -
param
arrayserverParams= []An array of Server API (SAPI) parameters with which to seed the generated request instance. -
return
ServerRequestInterface
Examples:
$serverRequestFactory = new ServerRequestFactory();
$method = 'GET';
$url = 'https://www.yourwebsite.com/current-page/';
$serverRequest = $serverRequestFactory->createServerRequest($method, $uri);(Non-PSR)
-
return
ServerRequestInterface
Examples:
$serverRequest = ServerRequestFactory::fromGlobal();composer require shieldon/psr-httpShieldon PSR HTTP implementation written by Terry L. from Taiwan.
