ServerRequest
in package
implements
ServerRequestInterface
uses
ServerRequestDecoratorTrait
Class ServerRequest
Table of Contents
Interfaces
- ServerRequestInterface
Methods
- __construct() : mixed
- getAttribute() : mixed
- getAttributes() : mixed
- getContentCharset() : string|null
- Get serverRequest content character set, if known.
- getContentLength() : int|null
- Get serverRequest content length, if known.
- getContentType() : string|null
- Get serverRequest content type.
- getCookieParam() : mixed
- Fetch cookie value from cookies sent by the client to the server.
- getCookieParams() : mixed
- getMediaType() : string|null
- Get serverRequest media type, if known.
- getMediaTypeParams() : array<string|int, mixed>
- Get serverRequest media type params, if known.
- getParam() : mixed
- Fetch serverRequest parameter value from body or query string (in that order).
- getParams() : array<string|int, mixed>
- Fetch associative array of body and query string parameters.
- getParsedBody() : mixed
- getParsedBodyParam() : mixed
- Fetch parameter value from serverRequest body.
- getQueryParam() : mixed
- Fetch parameter value from query string.
- getQueryParams() : mixed
- getRequest() : ServerRequestInterface
- Returns the decorated request.
- getServerParam() : mixed
- Retrieve a server parameter.
- getServerParams() : mixed
- getUploadedFiles() : mixed
- isDelete() : bool
- Is this a DELETE serverRequest?
- isGet() : bool
- Is this a GET serverRequest?
- isHead() : bool
- Is this a HEAD serverRequest?
- isMethod() : bool
- Does this serverRequest use a given method?
- isOptions() : bool
- Is this a OPTIONS serverRequest?
- isPatch() : bool
- Is this a PATCH serverRequest?
- isPost() : bool
- Is this a POST serverRequest?
- isPut() : bool
- Is this a PUT serverRequest?
- isXhr() : bool
- Is this an XHR serverRequest?
- withAttribute() : mixed
- withAttributes() : ServerRequestInterface
- withCookieParams() : mixed
- withoutAttribute() : mixed
- withParsedBody() : mixed
- withQueryParams() : mixed
- withUploadedFiles() : mixed
Methods
__construct()
public
__construct(string $method, string|UriInterface $uri[, array<string|int, mixed> $headers = [] ][, string|null|resource|StreamInterface $body = null ][, string $version = '1.1' ][, array<string|int, mixed> $serverParams = [] ]) : mixed
Parameters
- $method : string
-
HTTP method
- $uri : string|UriInterface
-
URI
- $headers : array<string|int, mixed> = []
-
Request headers
- $body : string|null|resource|StreamInterface = null
-
Request body
- $version : string = '1.1'
-
Protocol version
- $serverParams : array<string|int, mixed> = []
-
Typically the $_SERVER superglobal
getAttribute()
public
getAttribute(mixed $name[, mixed $default = null ]) : mixed
Parameters
- $name : mixed
- $default : mixed = null
Tags
getAttributes()
public
getAttributes() : mixed
Tags
getContentCharset()
Get serverRequest content character set, if known.
public
getContentCharset() : string|null
Note: This method is not part of the PSR-7 standard.
Return values
string|nullgetContentLength()
Get serverRequest content length, if known.
public
getContentLength() : int|null
Note: This method is not part of the PSR-7 standard.
Return values
int|nullgetContentType()
Get serverRequest content type.
public
getContentType() : string|null
Note: This method is not part of the PSR-7 standard.
Return values
string|null —The serverRequest content type, if known
getCookieParam()
Fetch cookie value from cookies sent by the client to the server.
public
getCookieParam(string $key[, mixed $default = null ]) : mixed
Note: This method is not part of the PSR-7 standard.
Parameters
- $key : string
-
The attribute name.
- $default : mixed = null
-
Default value to return if the attribute does not exist.
getCookieParams()
public
getCookieParams() : mixed
Tags
getMediaType()
Get serverRequest media type, if known.
public
getMediaType() : string|null
Note: This method is not part of the PSR-7 standard.
Return values
string|null —The serverRequest media type, minus content-type params
getMediaTypeParams()
Get serverRequest media type params, if known.
public
getMediaTypeParams() : array<string|int, mixed>
Note: This method is not part of the PSR-7 standard.
Return values
array<string|int, mixed>getParam()
Fetch serverRequest parameter value from body or query string (in that order).
public
getParam(string $key[, string|null $default = null ]) : mixed
Note: This method is not part of the PSR-7 standard.
Parameters
- $key : string
-
The parameter key.
- $default : string|null = null
-
The default value.
Return values
mixed —The parameter value.
getParams()
Fetch associative array of body and query string parameters.
public
getParams() : array<string|int, mixed>
Note: This method is not part of the PSR-7 standard.
Return values
array<string|int, mixed>getParsedBody()
public
getParsedBody() : mixed
Tags
getParsedBodyParam()
Fetch parameter value from serverRequest body.
public
getParsedBodyParam(string $key[, mixed $default = null ]) : mixed
Note: This method is not part of the PSR-7 standard.
Parameters
- $key : string
- $default : mixed = null
getQueryParam()
Fetch parameter value from query string.
public
getQueryParam(string $key[, mixed $default = null ]) : mixed
Note: This method is not part of the PSR-7 standard.
Parameters
- $key : string
- $default : mixed = null
getQueryParams()
public
getQueryParams() : mixed
Tags
getRequest()
Returns the decorated request.
public
getRequest() : ServerRequestInterface
Since the underlying Request is immutable as well exposing it is not an issue, because it's state cannot be altered
Return values
ServerRequestInterfacegetServerParam()
Retrieve a server parameter.
public
getServerParam(string $key[, mixed $default = null ]) : mixed
Note: This method is not part of the PSR-7 standard.
Parameters
- $key : string
- $default : mixed = null
getServerParams()
public
getServerParams() : mixed
Tags
getUploadedFiles()
public
getUploadedFiles() : mixed
Tags
isDelete()
Is this a DELETE serverRequest?
public
isDelete() : bool
Note: This method is not part of the PSR-7 standard.
Return values
boolisGet()
Is this a GET serverRequest?
public
isGet() : bool
Note: This method is not part of the PSR-7 standard.
Return values
boolisHead()
Is this a HEAD serverRequest?
public
isHead() : bool
Note: This method is not part of the PSR-7 standard.
Return values
boolisMethod()
Does this serverRequest use a given method?
public
isMethod(string $method) : bool
Note: This method is not part of the PSR-7 standard.
Parameters
- $method : string
-
HTTP method
Return values
boolisOptions()
Is this a OPTIONS serverRequest?
public
isOptions() : bool
Note: This method is not part of the PSR-7 standard.
Return values
boolisPatch()
Is this a PATCH serverRequest?
public
isPatch() : bool
Note: This method is not part of the PSR-7 standard.
Return values
boolisPost()
Is this a POST serverRequest?
public
isPost() : bool
Note: This method is not part of the PSR-7 standard.
Return values
boolisPut()
Is this a PUT serverRequest?
public
isPut() : bool
Note: This method is not part of the PSR-7 standard.
Return values
boolisXhr()
Is this an XHR serverRequest?
public
isXhr() : bool
Note: This method is not part of the PSR-7 standard.
Return values
boolwithAttribute()
public
withAttribute(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
Tags
withAttributes()
public
withAttributes(array<string|int, mixed> $attributes) : ServerRequestInterface
Parameters
- $attributes : array<string|int, mixed>
Return values
ServerRequestInterfacewithCookieParams()
public
withCookieParams(array<string|int, mixed> $cookies) : mixed
Parameters
- $cookies : array<string|int, mixed>
Tags
withoutAttribute()
public
withoutAttribute(mixed $name) : mixed
Parameters
- $name : mixed
Tags
withParsedBody()
public
withParsedBody(mixed $data) : mixed
Parameters
- $data : mixed
Tags
withQueryParams()
public
withQueryParams(array<string|int, mixed> $query) : mixed
Parameters
- $query : array<string|int, mixed>
Tags
withUploadedFiles()
public
withUploadedFiles(array<string|int, mixed> $uploadedFiles) : mixed
Parameters
- $uploadedFiles : array<string|int, mixed>