HumHub Documentation (unofficial)

Request extends AbstractMessage
in package
implements RequestInterface

HTTP Request

Tags
link
http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5

Table of Contents

Interfaces

RequestInterface

Constants

METHOD_CONNECT  = 'CONNECT'
METHOD_DELETE  = 'DELETE'
METHOD_GET  = 'GET'
METHOD_HEAD  = 'HEAD'
METHOD_OPTIONS  = 'OPTIONS'
METHOD_PATCH  = 'PATCH'
METHOD_POST  = 'POST'
METHOD_PROPFIND  = 'PROPFIND'
METHOD_PUT  = 'PUT'
METHOD_TRACE  = 'TRACE'
VERSION_10  = '1.0'
VERSION_11  = '1.1'
VERSION_2  = '2'

Properties

$allowCustomMethods  : bool
$content  : mixed
$fileParams  : ParametersInterface
$headers  : Headers|null
$metadata  : array<string|int, mixed>
$method  : string
$postParams  : ParametersInterface
$queryParams  : ParametersInterface
$uri  : string|Http
$version  : string

Methods

__toString()  : string
Allow PHP casting of this object
fromString()  : static
A factory that produces a Request object from a well-formed Http Request string
getAllowCustomMethods()  : bool
getContent()  : mixed
Get message content
getCookie()  : Cookie|bool
Return the Cookie header, this is the same as calling $request->getHeaders()->get('Cookie');
getFiles()  : ParametersInterface|mixed
Return the parameter container responsible for file parameters or a single file.
getHeader()  : Headers|bool|HeaderInterface|ArrayIterator
Get all headers of a certain name/type.
getHeaders()  : Headers|bool|HeaderInterface|ArrayIterator
Return the header container responsible for headers or all headers of a certain name/type
getMetadata()  : mixed
Retrieve all metadata or a single metadatum as specified by key
getMethod()  : string
Return the method for this request
getPost()  : ParametersInterface|mixed
Return the parameter container responsible for post parameters or a single post parameter.
getQuery()  : ParametersInterface|mixed
Return the parameter container responsible for query parameters or a single query parameter
getUri()  : Http
Return the URI for this request object
getUriString()  : string
Return the URI for this request object as a string
getVersion()  : string
Return the HTTP version for this request
isConnect()  : bool
Is this a CONNECT method request?
isDelete()  : bool
Is this a DELETE method request?
isFlashRequest()  : bool
Is this a Flash request?
isGet()  : bool
Is this a GET method request?
isHead()  : bool
Is this a HEAD method request?
isOptions()  : bool
Is this an OPTIONS method request?
isPatch()  : bool
Is this a PATCH method request?
isPost()  : bool
Is this a POST method request?
isPropFind()  : bool
Is this a PROPFIND method request?
isPut()  : bool
Is this a PUT method request?
isTrace()  : bool
Is this a TRACE method request?
isXmlHttpRequest()  : bool
Is the request a Javascript XMLHttpRequest?
renderRequestLine()  : string
Return the formatted request line (first line) for this http request
setAllowCustomMethods()  : mixed
setContent()  : Message
Set message content
setFiles()  : $this
Provide an alternate Parameter Container implementation for file parameters in this object, (this is NOT the primary API for value setting, for that see getFiles())
setHeaders()  : $this
Provide an alternate Parameter Container implementation for headers in this object, (this is NOT the primary API for value setting, for that see getHeaders())
setMetadata()  : Message
Set message metadata
setMethod()  : $this
Set the method for this request
setPost()  : $this
Provide an alternate Parameter Container implementation for post parameters in this object, (this is NOT the primary API for value setting, for that see getPost())
setQuery()  : $this
Provide an alternate Parameter Container implementation for query parameters in this object, (this is NOT the primary API for value setting, for that see getQuery())
setUri()  : $this
Set the URI/URL for this request, this can be a string or an instance of Laminas\Uri\Http
setVersion()  : $this
Set the HTTP version for this object, one of 1.0, 1.1 or 2 (AbstractMessage::VERSION_10, AbstractMessage::VERSION_11, AbstractMessage::VERSION_2)
toString()  : string

Constants

METHOD_CONNECT

public mixed METHOD_CONNECT = 'CONNECT'

METHOD_DELETE

public mixed METHOD_DELETE = 'DELETE'

METHOD_GET

public mixed METHOD_GET = 'GET'

METHOD_HEAD

public mixed METHOD_HEAD = 'HEAD'

METHOD_OPTIONS

public mixed METHOD_OPTIONS = 'OPTIONS'

METHOD_PATCH

public mixed METHOD_PATCH = 'PATCH'

METHOD_POST

public mixed METHOD_POST = 'POST'

METHOD_PROPFIND

public mixed METHOD_PROPFIND = 'PROPFIND'

METHOD_PUT

public mixed METHOD_PUT = 'PUT'

METHOD_TRACE

public mixed METHOD_TRACE = 'TRACE'

Properties

$allowCustomMethods

protected bool $allowCustomMethods = true

$content

protected mixed $content = ''

$metadata

protected array<string|int, mixed> $metadata = []

$method

protected string $method = self::METHOD_GET

Methods

__toString()

Allow PHP casting of this object

public __toString() : string
Return values
string

fromString()

A factory that produces a Request object from a well-formed Http Request string

public static fromString(string $string[, bool $allowCustomMethods = true ]) : static
Parameters
$string : string
$allowCustomMethods : bool = true
Tags
throws
InvalidArgumentException
Return values
static

getAllowCustomMethods()

public getAllowCustomMethods() : bool
Return values
bool

getContent()

Get message content

public getContent() : mixed

getCookie()

Return the Cookie header, this is the same as calling $request->getHeaders()->get('Cookie');

public getCookie() : Cookie|bool
Tags
convenience

$request->getHeaders()->get('Cookie');

Return values
Cookie|bool

getFiles()

Return the parameter container responsible for file parameters or a single file.

public getFiles([string|null $name = null ][, mixed|null $default = null ]) : ParametersInterface|mixed
Parameters
$name : string|null = null

Parameter name to retrieve, or null to get the whole container.

$default : mixed|null = null

Default value to use when the parameter is missing.

Return values
ParametersInterface|mixed

getHeader()

Get all headers of a certain name/type.

public getHeader(string|null $name[, mixed|null $default = false ]) : Headers|bool|HeaderInterface|ArrayIterator
Parameters
$name : string|null

Header name to retrieve, or null to get the whole container.

$default : mixed|null = false

Default value to use when the requested header is missing.

Tags
see
Request::getHeaders()
Return values
Headers|bool|HeaderInterface|ArrayIterator

getHeaders()

Return the header container responsible for headers or all headers of a certain name/type

public getHeaders([string|null $name = null ][, mixed|null $default = false ]) : Headers|bool|HeaderInterface|ArrayIterator
Parameters
$name : string|null = null

Header name to retrieve, or null to get the whole container.

$default : mixed|null = false

Default value to use when the requested header is missing.

Tags
see
Headers::get()
Return values
Headers|bool|HeaderInterface|ArrayIterator

getMetadata()

Retrieve all metadata or a single metadatum as specified by key

public getMetadata([null|string|int $key = null ][, null|mixed $default = null ]) : mixed
Parameters
$key : null|string|int = null
$default : null|mixed = null
Tags
throws
InvalidArgumentException

getMethod()

Return the method for this request

public getMethod() : string
Return values
string

getPost()

Return the parameter container responsible for post parameters or a single post parameter.

public getPost([string|null $name = null ][, mixed|null $default = null ]) : ParametersInterface|mixed
Parameters
$name : string|null = null

Parameter name to retrieve, or null to get the whole container.

$default : mixed|null = null

Default value to use when the parameter is missing.

Return values
ParametersInterface|mixed

getQuery()

Return the parameter container responsible for query parameters or a single query parameter

public getQuery([string|null $name = null ][, mixed|null $default = null ]) : ParametersInterface|mixed
Parameters
$name : string|null = null

Parameter name to retrieve, or null to get the whole container.

$default : mixed|null = null

Default value to use when the parameter is missing.

Return values
ParametersInterface|mixed

getUri()

Return the URI for this request object

public getUri() : Http
Return values
Http

getUriString()

Return the URI for this request object as a string

public getUriString() : string
Return values
string

getVersion()

Return the HTTP version for this request

public getVersion() : string
Return values
string

isConnect()

Is this a CONNECT method request?

public isConnect() : bool
Return values
bool

isDelete()

Is this a DELETE method request?

public isDelete() : bool
Return values
bool

isFlashRequest()

Is this a Flash request?

public isFlashRequest() : bool
Return values
bool

isGet()

Is this a GET method request?

public isGet() : bool
Return values
bool

isHead()

Is this a HEAD method request?

public isHead() : bool
Return values
bool

isOptions()

Is this an OPTIONS method request?

public isOptions() : bool
Return values
bool

isPatch()

Is this a PATCH method request?

public isPatch() : bool
Return values
bool

isPost()

Is this a POST method request?

public isPost() : bool
Return values
bool

isPropFind()

Is this a PROPFIND method request?

public isPropFind() : bool
Return values
bool

isPut()

Is this a PUT method request?

public isPut() : bool
Return values
bool

isTrace()

Is this a TRACE method request?

public isTrace() : bool
Return values
bool

isXmlHttpRequest()

Is the request a Javascript XMLHttpRequest?

public isXmlHttpRequest() : bool

Should work with Prototype/Script.aculo.us, possibly others.

Return values
bool

renderRequestLine()

Return the formatted request line (first line) for this http request

public renderRequestLine() : string
Return values
string

setAllowCustomMethods()

public setAllowCustomMethods(bool $strictMethods) : mixed
Parameters
$strictMethods : bool

setContent()

Set message content

public setContent(mixed $value) : Message
Parameters
$value : mixed
Return values
Message

setFiles()

Provide an alternate Parameter Container implementation for file parameters in this object, (this is NOT the primary API for value setting, for that see getFiles())

public setFiles(ParametersInterface $files) : $this
Parameters
$files : ParametersInterface
Return values
$this

setHeaders()

Provide an alternate Parameter Container implementation for headers in this object, (this is NOT the primary API for value setting, for that see getHeaders())

public setHeaders(Headers $headers) : $this
Parameters
$headers : Headers
Tags
see
getHeaders()
Return values
$this

setMetadata()

Set message metadata

public setMetadata(string|int|array<string|int, mixed>|Traversable $spec[, mixed $value = null ]) : Message

Non-destructive setting of message metadata; always adds to the metadata, never overwrites the entire metadata container.

Parameters
$spec : string|int|array<string|int, mixed>|Traversable
$value : mixed = null
Tags
throws
InvalidArgumentException
Return values
Message

setMethod()

Set the method for this request

public setMethod(string $method) : $this
Parameters
$method : string
Tags
throws
InvalidArgumentException
Return values
$this

setPost()

Provide an alternate Parameter Container implementation for post parameters in this object, (this is NOT the primary API for value setting, for that see getPost())

public setPost(ParametersInterface $post) : $this
Parameters
$post : ParametersInterface
Return values
$this

setQuery()

Provide an alternate Parameter Container implementation for query parameters in this object, (this is NOT the primary API for value setting, for that see getQuery())

public setQuery(ParametersInterface $query) : $this
Parameters
$query : ParametersInterface
Return values
$this

setUri()

Set the URI/URL for this request, this can be a string or an instance of Laminas\Uri\Http

public setUri(string|Http $uri) : $this
Parameters
$uri : string|Http
Tags
throws
InvalidArgumentException
Return values
$this

setVersion()

Set the HTTP version for this object, one of 1.0, 1.1 or 2 (AbstractMessage::VERSION_10, AbstractMessage::VERSION_11, AbstractMessage::VERSION_2)

public setVersion(string $version) : $this
Parameters
$version : string

(Must be 1.0, 1.1 or 2)

Tags
throws
InvalidArgumentException
Return values
$this

toString()

public toString() : string
Return values
string

        
On this page

Search results