Request
extends AbstractMessage
in package
implements
RequestInterface
HTTP Request
Tags
Table of Contents
Interfaces
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'
VERSION_10
public
mixed
VERSION_10
= '1.0'
VERSION_11
public
mixed
VERSION_11
= '1.1'
VERSION_2
public
mixed
VERSION_2
= '2'
Properties
$allowCustomMethods
protected
bool
$allowCustomMethods
= true
$content
protected
mixed
$content
= ''
$fileParams
protected
ParametersInterface
$fileParams
$headers
protected
Headers|null
$headers
$metadata
protected
array<string|int, mixed>
$metadata
= []
$method
protected
string
$method
= self::METHOD_GET
$postParams
protected
ParametersInterface
$postParams
$queryParams
protected
ParametersInterface
$queryParams
$uri
protected
string|Http
$uri
$version
protected
string
$version
= self::VERSION_11
Methods
__toString()
Allow PHP casting of this object
public
__toString() : string
Return values
stringfromString()
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
Return values
staticgetAllowCustomMethods()
public
getAllowCustomMethods() : bool
Return values
boolgetContent()
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
Return values
Cookie|boolgetFiles()
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|mixedgetHeader()
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
Return values
Headers|bool|HeaderInterface|ArrayIteratorgetHeaders()
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
Return values
Headers|bool|HeaderInterface|ArrayIteratorgetMetadata()
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
getMethod()
Return the method for this request
public
getMethod() : string
Return values
stringgetPost()
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|mixedgetQuery()
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|mixedgetUri()
Return the URI for this request object
public
getUri() : Http
Return values
HttpgetUriString()
Return the URI for this request object as a string
public
getUriString() : string
Return values
stringgetVersion()
Return the HTTP version for this request
public
getVersion() : string
Return values
stringisConnect()
Is this a CONNECT method request?
public
isConnect() : bool
Return values
boolisDelete()
Is this a DELETE method request?
public
isDelete() : bool
Return values
boolisFlashRequest()
Is this a Flash request?
public
isFlashRequest() : bool
Return values
boolisGet()
Is this a GET method request?
public
isGet() : bool
Return values
boolisHead()
Is this a HEAD method request?
public
isHead() : bool
Return values
boolisOptions()
Is this an OPTIONS method request?
public
isOptions() : bool
Return values
boolisPatch()
Is this a PATCH method request?
public
isPatch() : bool
Return values
boolisPost()
Is this a POST method request?
public
isPost() : bool
Return values
boolisPropFind()
Is this a PROPFIND method request?
public
isPropFind() : bool
Return values
boolisPut()
Is this a PUT method request?
public
isPut() : bool
Return values
boolisTrace()
Is this a TRACE method request?
public
isTrace() : bool
Return values
boolisXmlHttpRequest()
Is the request a Javascript XMLHttpRequest?
public
isXmlHttpRequest() : bool
Should work with Prototype/Script.aculo.us, possibly others.
Return values
boolrenderRequestLine()
Return the formatted request line (first line) for this http request
public
renderRequestLine() : string
Return values
stringsetAllowCustomMethods()
public
setAllowCustomMethods(bool $strictMethods) : mixed
Parameters
- $strictMethods : bool
setContent()
Set message content
public
setContent(mixed $value) : Message
Parameters
- $value : mixed
Return values
MessagesetFiles()
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
$thissetHeaders()
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
Return values
$thissetMetadata()
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
Return values
MessagesetMethod()
Set the method for this request
public
setMethod(string $method) : $this
Parameters
- $method : string
Tags
Return values
$thissetPost()
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
$thissetQuery()
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
$thissetUri()
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
Return values
$thissetVersion()
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
Return values
$thistoString()
public
toString() : string