ServerRequest
extends Request
in package
implements
ServerRequestInterface
Implements a server-side incoming HTTP request
Table of Contents
Interfaces
- ServerRequestInterface
Properties
- $attributes : array<string, mixed>
- $body : StreamInterface
- $cookieParams : array<string, string>
- $headers : array<string, array{name: string, value: string[]}>
- $method : string
- $parsedBody : array<string|int, mixed>|object|null
- $queryParams : array<string, string>
- $requestTarget : string|null
- $serverParams : array<int|string, mixed>
- $uploadedFiles : array{tmp_name: string[], size: int[], error: int[], name: string[], type: string[]}
- $uri : UriInterface
- $version : string
Methods
- __construct() : mixed
- ServerRequest constructor.
- getAttribute() : mixed
- getAttributes() : array<string, mixed>
- getBody() : StreamInterface
- getCookieParams() : array<string, string>
- getHeader() : array<string|int, mixed>
- getHeaderLine() : string
- getHeaders() : array<string|int, mixed>
- getMethod() : string
- getParsedBody() : array<string|int, mixed>|object|null
- getProtocolVersion() : string
- getQueryParams() : array<string, string>
- getRequestTarget() : string
- getServerParams() : array<int|string, mixed>
- getUploadedFiles() : array{tmp_name: string[], size: int[], error: int[], name: string[], type: string[]}
- getUri() : UriInterface
- hasHeader() : bool
- withAddedHeader() : static
- withAttribute() : static
- withBody() : static
- withCookieParams() : static
- withHeader() : static
- withMethod() : static
- withoutAttribute() : static
- withoutHeader() : static
- withParsedBody() : static
- withProtocolVersion() : static
- withQueryParams() : static
- withRequestTarget() : static
- withUploadedFiles() : static
- withUri() : static
- checkName() : string
- checks/cleans a header name
- checkValue() : array<string|int, string>
- updateHostFromUri() : void
Properties
$attributes
protected
array<string, mixed>
$attributes
= []
$body
protected
StreamInterface
$body
$cookieParams
protected
array<string, string>
$cookieParams
= []
$headers
protected
array<string, array{name: string, value: string[]}>
$headers
= []
$method
protected
string
$method
$parsedBody
protected
array<string|int, mixed>|object|null
$parsedBody
= null
$queryParams
protected
array<string, string>
$queryParams
= []
$requestTarget
protected
string|null
$requestTarget
= null
$serverParams
protected
array<int|string, mixed>
$serverParams
$uploadedFiles
protected
array{tmp_name: string[], size: int[], error: int[], name: string[], type: string[]}
$uploadedFiles
= []
$uri
protected
UriInterface
$uri
$version
protected
string
$version
= '1.1'
Methods
__construct()
ServerRequest constructor.
public
__construct(string $method, UriInterface|string $uri[, array<int|string, mixed>|null $serverParams = null ]) : mixed
Parameters
- $method : string
- $uri : UriInterface|string
- $serverParams : array<int|string, mixed>|null = null
getAttribute()
public
getAttribute(string $name[, mixed $default = null ]) : mixed
Parameters
- $name : string
- $default : mixed = null
getAttributes()
public
getAttributes() : array<string, mixed>
Return values
array<string, mixed>getBody()
public
getBody() : StreamInterface
Return values
StreamInterfacegetCookieParams()
public
getCookieParams() : array<string, string>
Return values
array<string, string>getHeader()
public
getHeader(string $name) : array<string|int, mixed>
Parameters
- $name : string
Return values
array<string|int, mixed>getHeaderLine()
public
getHeaderLine(string $name) : string
Parameters
- $name : string
Return values
stringgetHeaders()
public
getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>getMethod()
public
getMethod() : string
Return values
stringgetParsedBody()
public
getParsedBody() : array<string|int, mixed>|object|null
Return values
array<string|int, mixed>|object|nullgetProtocolVersion()
public
getProtocolVersion() : string
Return values
stringgetQueryParams()
public
getQueryParams() : array<string, string>
Return values
array<string, string>getRequestTarget()
public
getRequestTarget() : string
Return values
stringgetServerParams()
public
getServerParams() : array<int|string, mixed>
Return values
array<int|string, mixed>getUploadedFiles()
public
getUploadedFiles() : array{tmp_name: string[], size: int[], error: int[], name: string[], type: string[]}
Return values
array{tmp_name: string[], size: int[], error: int[], name: string[], type: string[]}getUri()
public
getUri() : UriInterface
Return values
UriInterfacehasHeader()
public
hasHeader(string $name) : bool
Parameters
- $name : string
Return values
boolwithAddedHeader()
public
withAddedHeader(string $name, mixed $value) : static
Parameters
- $name : string
- $value : mixed
Return values
staticwithAttribute()
public
withAttribute(string $name, mixed $value) : static
Parameters
- $name : string
- $value : mixed
Return values
staticwithBody()
public
withBody(StreamInterface $body) : static
Parameters
- $body : StreamInterface
Return values
staticwithCookieParams()
public
withCookieParams(array<string, string> $cookies) : static
Parameters
- $cookies : array<string, string>
Return values
staticwithHeader()
public
withHeader(string $name, mixed $value) : static
Parameters
- $name : string
- $value : mixed
Return values
staticwithMethod()
public
withMethod(string $method) : static
Parameters
- $method : string
Return values
staticwithoutAttribute()
public
withoutAttribute(string $name) : static
Parameters
- $name : string
Return values
staticwithoutHeader()
public
withoutHeader(string $name) : static
Parameters
- $name : string
Return values
staticwithParsedBody()
public
withParsedBody(array<string|int, mixed>|object|null $data) : static
Parameters
- $data : array<string|int, mixed>|object|null
Return values
staticwithProtocolVersion()
public
withProtocolVersion(string $version) : static
Parameters
- $version : string
Return values
staticwithQueryParams()
public
withQueryParams(array<string, string> $query) : static
Parameters
- $query : array<string, string>
Return values
staticwithRequestTarget()
public
withRequestTarget(string $requestTarget) : static
Parameters
- $requestTarget : string
Return values
staticwithUploadedFiles()
public
withUploadedFiles(array{tmp_name: string[], size: int[], error: int[], name: string[], type: string[]} $uploadedFiles) : static
Parameters
- $uploadedFiles : array{tmp_name: string[], size: int[], error: int[], name: string[], type: string[]}
Return values
staticwithUri()
public
withUri(UriInterface $uri[, bool $preserveHost = false ]) : static
Parameters
- $uri : UriInterface
- $preserveHost : bool = false
Return values
staticcheckName()
checks/cleans a header name
protected
checkName(string $name) : string
Parameters
- $name : string
Tags
Return values
stringcheckValue()
protected
checkValue(mixed $value) : array<string|int, string>
Parameters
- $value : mixed
Tags
Return values
array<string|int, string>updateHostFromUri()
protected
updateHostFromUri() : void