Documentation

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

$body

protected StreamInterface $body

$cookieParams

protected array<string, string> $cookieParams = []

$headers

protected array<string, array{name: string, value: string[]}> $headers = []

$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 = []

$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
StreamInterface

getCookieParams()

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
string

getHeaders()

public getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMethod()

public getMethod() : string
Return values
string

getParsedBody()

public getParsedBody() : array<string|int, mixed>|object|null
Return values
array<string|int, mixed>|object|null

getProtocolVersion()

public getProtocolVersion() : string
Return values
string

getQueryParams()

public getQueryParams() : array<string, string>
Return values
array<string, string>

getRequestTarget()

public getRequestTarget() : string
Return values
string

getServerParams()

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
UriInterface

hasHeader()

public hasHeader(string $name) : bool
Parameters
$name : string
Return values
bool

withAddedHeader()

public withAddedHeader(string $name, mixed $value) : static
Parameters
$name : string
$value : mixed
Return values
static

withAttribute()

public withAttribute(string $name, mixed $value) : static
Parameters
$name : string
$value : mixed
Return values
static

withBody()

public withBody(StreamInterface $body) : static
Parameters
$body : StreamInterface
Return values
static

withCookieParams()

public withCookieParams(array<string, string> $cookies) : static
Parameters
$cookies : array<string, string>
Return values
static

withHeader()

public withHeader(string $name, mixed $value) : static
Parameters
$name : string
$value : mixed
Return values
static

withMethod()

public withMethod(string $method) : static
Parameters
$method : string
Return values
static

withoutAttribute()

public withoutAttribute(string $name) : static
Parameters
$name : string
Return values
static

withoutHeader()

public withoutHeader(string $name) : static
Parameters
$name : string
Return values
static

withParsedBody()

public withParsedBody(array<string|int, mixed>|object|null $data) : static
Parameters
$data : array<string|int, mixed>|object|null
Return values
static

withProtocolVersion()

public withProtocolVersion(string $version) : static
Parameters
$version : string
Return values
static

withQueryParams()

public withQueryParams(array<string, string> $query) : static
Parameters
$query : array<string, string>
Return values
static

withRequestTarget()

public withRequestTarget(string $requestTarget) : static
Parameters
$requestTarget : string
Return values
static

withUploadedFiles()

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
static

withUri()

public withUri(UriInterface $uri[, bool $preserveHost = false ]) : static
Parameters
$uri : UriInterface
$preserveHost : bool = false
Return values
static

updateHostFromUri()

protected updateHostFromUri() : void

        
On this page

Search results