Zend Framework  3.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Request Class Reference

HTTP Request for current PHP environment. More...

Public Member Functions

 __construct ($allowCustomMethods=true)
 Construct Instantiates request.
 
 getContent ()
 Get raw request body.
 
 setCookies ($cookie)
 Set cookies.
 
 setRequestUri ($requestUri)
 Set the request URI.
 
 getRequestUri ()
 Get the request URI.
 
 setBaseUrl ($baseUrl)
 Set the base URL.
 
 getBaseUrl ()
 Get the base URL.
 
 setBasePath ($basePath)
 Set the base path.
 
 getBasePath ()
 Get the base path.
 
 setServer (ParametersInterface $server)
 Provide an alternate Parameter Container implementation for server parameters in this object, (this is NOT the primary API for value setting, for that see getServer())
 
 getServer ($name=null, $default=null)
 Return the parameter container responsible for server parameters or a single parameter value.
 
 setEnv (ParametersInterface $env)
 Provide an alternate Parameter Container implementation for env parameters in this object, (this is NOT the primary API for value setting, for that see env())
 
 getEnv ($name=null, $default=null)
 Return the parameter container responsible for env parameters or a single parameter value.
 
- Public Member Functions inherited from Request
 setMethod ($method)
 Set the method for this request.
 
 getMethod ()
 Return the method for this request.
 
 setUri ($uri)
 Set the URI/URL for this request, this can be a string or an instance of Zend.
 
 getUri ()
 Return the URI for this request object.
 
 getUriString ()
 Return the URI for this request object as a string.
 
 setQuery (ParametersInterface $query)
 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())
 
 getQuery ($name=null, $default=null)
 Return the parameter container responsible for query parameters or a single query parameter.
 
 setPost (ParametersInterface $post)
 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())
 
 getPost ($name=null, $default=null)
 Return the parameter container responsible for post parameters or a single post parameter.
 
 getCookie ()
 Return the Cookie header, this is the same as calling $request->getHeaders()->get('Cookie');.
 
 setFiles (ParametersInterface $files)
 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())
 
 getFiles ($name=null, $default=null)
 Return the parameter container responsible for file parameters or a single file.
 
 getHeaders ($name=null, $default=false)
 Return the header container responsible for headers or all headers of a certain name/type.
 
 getHeader ($name, $default=false)
 Get all headers of a certain name/type.
 
 isOptions ()
 Is this an OPTIONS method request?
 
 isPropFind ()
 Is this a PROPFIND method request?
 
 isGet ()
 Is this a GET method request?
 
 isHead ()
 Is this a HEAD method request?
 
 isPost ()
 Is this a POST method request?
 
 isPut ()
 Is this a PUT method request?
 
 isDelete ()
 Is this a DELETE method request?
 
 isTrace ()
 Is this a TRACE method request?
 
 isConnect ()
 Is this a CONNECT method request?
 
 isPatch ()
 Is this a PATCH method request?
 
 isXmlHttpRequest ()
 Is the request a Javascript XMLHttpRequest?
 
 isFlashRequest ()
 Is this a Flash request?
 
 renderRequestLine ()
 Return the formatted request line (first line) for this http request.
 
 toString ()
 
 getAllowCustomMethods ()
 
 setAllowCustomMethods ($strictMethods)
 
- Public Member Functions inherited from AbstractMessage
 setVersion ($version)
 Set the HTTP version for this object, one of 1.0 or 1.1 (AbstractMessage::VERSION_10, AbstractMessage::VERSION_11)
 
 getVersion ()
 Return the HTTP version for this request.
 
 setHeaders (Headers $headers)
 Provide an alternate Parameter Container implementation for headers in this object, (this is NOT the primary API for value setting, for that see getHeaders())
 
 getHeaders ()
 Return the header container responsible for headers.
 
 __toString ()
 Allow PHP casting of this object.
 
- Public Member Functions inherited from Message
 setMetadata ($spec, $value=null)
 Set message metadata.
 
 getMetadata ($key=null, $default=null)
 Retrieve all metadata or a single metadatum as specified by key.
 
 setContent ($value)
 Set message content.
 
 getContent ()
 Get message content.
 
 toString ()
 
- Public Member Functions inherited from MessageInterface
 getMetadata ($key=null)
 Get metadata.
 

Protected Member Functions

 mapPhpFiles ()
 Convert PHP superglobal $_FILES into more sane parameter=value structure This handles form file input with brackets (name=files[])
 
 mapPhpFileParam (&$array, $paramName, $index, $value)
 
 detectRequestUri ()
 Detect the base URI for the request.
 
 detectBaseUrl ()
 Auto-detect the base path from the request environment.
 
 detectBasePath ()
 Autodetect the base path of the request.
 

Protected Attributes

 $baseUrl
 
 $basePath
 
 $requestUri
 
 $serverParams = null
 
 $envParams = null
 
- Protected Attributes inherited from Request
 $method = self::METHOD_GET
 
 $allowCustomMethods = true
 
 $uri = null
 
 $queryParams = null
 
 $postParams = null
 
 $fileParams = null
 
- Protected Attributes inherited from AbstractMessage
 $version = self::VERSION_11
 
 $headers = null
 
- Protected Attributes inherited from Message
 $metadata = []
 
 $content = ''
 

Additional Inherited Members

- Static Public Member Functions inherited from Request
static fromString ($string, $allowCustomMethods=true)
 A factory that produces a Request object from a well-formed Http Request string.
 
- Public Attributes inherited from Request
const METHOD_OPTIONS = 'OPTIONS'
 #@+ string METHOD constant names
 
const METHOD_GET = 'GET'
 
const METHOD_HEAD = 'HEAD'
 
const METHOD_POST = 'POST'
 
const METHOD_PUT = 'PUT'
 
const METHOD_DELETE = 'DELETE'
 
const METHOD_TRACE = 'TRACE'
 
const METHOD_CONNECT = 'CONNECT'
 
const METHOD_PATCH = 'PATCH'
 
const METHOD_PROPFIND = 'PROPFIND'
 

Detailed Description

HTTP Request for current PHP environment.

Constructor & Destructor Documentation

__construct (   $allowCustomMethods = true)

Construct Instantiates request.

Parameters
bool$allowCustomMethods

Member Function Documentation

detectBasePath ( )
protected

Autodetect the base path of the request.

Uses several criteria to determine the base path of the request.

Returns
string
detectBaseUrl ( )
protected

Auto-detect the base path from the request environment.

Uses a variety of criteria in order to detect the base URL of the request (i.e., anything additional to the document root).

Returns
string
detectRequestUri ( )
protected

Detect the base URI for the request.

Looks at a variety of criteria in order to attempt to autodetect a base URI, including rewrite URIs, proxy URIs, etc.

Returns
string
getBasePath ( )

Get the base path.

Returns
string
getBaseUrl ( )

Get the base URL.

Returns
string
getContent ( )

Get raw request body.

Returns
string

Implements MessageInterface.

getEnv (   $name = null,
  $default = null 
)

Return the parameter container responsible for env parameters or a single parameter value.

Parameters
string | null$nameParameter name to retrieve, or null to get the whole container.
mixed | null$defaultDefault value to use when the parameter is missing.
Returns
|mixed
getRequestUri ( )

Get the request URI.

Returns
string
getServer (   $name = null,
  $default = null 
)

Return the parameter container responsible for server parameters or a single parameter value.

Parameters
string | null$nameParameter name to retrieve, or null to get the whole container.
mixed | null$defaultDefault value to use when the parameter is missing.
See Also
http://www.faqs.org/rfcs/rfc3875.html
Returns
|mixed
mapPhpFileParam ( $array,
  $paramName,
  $index,
  $value 
)
protected
Parameters
array$array
string$paramName
int | string$index
string | array$value
mapPhpFiles ( )
protected

Convert PHP superglobal $_FILES into more sane parameter=value structure This handles form file input with brackets (name=files[])

Returns
array
setBasePath (   $basePath)

Set the base path.

Parameters
string$basePath
Returns
self
setBaseUrl (   $baseUrl)

Set the base URL.

Parameters
string$baseUrl
Returns
self
setCookies (   $cookie)

Set cookies.

Instantiate and set cookies.

Parameters
$cookie
Returns
Request
setEnv ( ParametersInterface  $env)

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

Parameters
ParametersInterface$env
Returns
Request
setRequestUri (   $requestUri)

Set the request URI.

Parameters
string$requestUri
Returns
self
setServer ( ParametersInterface  $server)

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

Parameters
ParametersInterface$server
Returns
Request

Member Data Documentation

$basePath
protected
$baseUrl
protected
$envParams = null
protected
$requestUri
protected
$serverParams = null
protected