Request
extends Message
in package
implements
RequestInterface, RequestMethodInterface
Implements a HTTP request message
Table of Contents
Interfaces
- RequestInterface
- RequestMethodInterface
Properties
- $body : StreamInterface
- $headers : array<string, array{name: string, value: string[]}>
- $method : string
- $requestTarget : string|null
- $uri : UriInterface
- $version : string
Methods
- __construct() : mixed
- Request constructor.
- getBody() : StreamInterface
- getHeader() : array<string|int, mixed>
- getHeaderLine() : string
- getHeaders() : array<string|int, mixed>
- getMethod() : string
- getProtocolVersion() : string
- getRequestTarget() : string
- getUri() : UriInterface
- hasHeader() : bool
- withAddedHeader() : static
- withBody() : static
- withHeader() : static
- withMethod() : static
- withoutHeader() : static
- withProtocolVersion() : static
- withRequestTarget() : static
- withUri() : static
- checkName() : string
- checks/cleans a header name
- checkValue() : array<string|int, string>
- updateHostFromUri() : void
Properties
$body
protected
StreamInterface
$body
$headers
protected
array<string, array{name: string, value: string[]}>
$headers
= []
$method
protected
string
$method
$requestTarget
protected
string|null
$requestTarget
= null
$uri
protected
UriInterface
$uri
$version
protected
string
$version
= '1.1'
Methods
__construct()
Request constructor.
public
__construct(string $method, UriInterface|string $uri[, StreamInterface|string|null $body = null ]) : mixed
Parameters
- $method : string
- $uri : UriInterface|string
- $body : StreamInterface|string|null = null
getBody()
public
getBody() : StreamInterface
Return values
StreamInterfacegetHeader()
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
stringgetProtocolVersion()
public
getProtocolVersion() : string
Return values
stringgetRequestTarget()
public
getRequestTarget() : string
Return values
stringgetUri()
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
staticwithBody()
public
withBody(StreamInterface $body) : static
Parameters
- $body : StreamInterface
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
staticwithoutHeader()
public
withoutHeader(string $name) : static
Parameters
- $name : string
Return values
staticwithProtocolVersion()
public
withProtocolVersion(string $version) : static
Parameters
- $version : string
Return values
staticwithRequestTarget()
public
withRequestTarget(string $requestTarget) : static
Parameters
- $requestTarget : 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