HTTP Request for current PHP environment

package Default
inherited_from \Zend\Http\Request

 Methods

Construct Instantiates request.

__construct(boolean $allowCustomMethods = true

Parameters

$allowCustomMethods

boolean

Allow PHP casting of this object

__toString() : string
Inherited

Returns

string

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

fromString(string $string, boolean $allowCustomMethods = true) : \Zend\Http\Request
InheritedStatic

Parameters

$string

string

$allowCustomMethods

boolean

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

\Zend\Http\Request

getAllowCustomMethods()

getAllowCustomMethods() : boolean
Inherited

Returns

boolean

Get the base path.

getBasePath() : string

Returns

string

Get the base URL.

getBaseUrl() : string

Returns

string

Get raw request body

getContent() : string

Returns

string

Get message content

getContent() : mixed
Inherited
inherited_from \Zend\Stdlib\MessageInterface::getContent()

Returns

mixed

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

getCookie() : \Zend\Http\Header\Cookie | boolean
Inherited
convenience $request->getHeaders()->get('Cookie');

Returns

\Zend\Http\Header\Cookieboolean

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

getEnv(string|null $name = null, mixed|null $default = null) : \Zend\Stdlib\ParametersInterface | mixed

Parameters

$name

stringnull

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

$default

mixednull

Default value to use when the parameter is missing.

Returns

\Zend\Stdlib\ParametersInterfacemixed

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

getFiles(string|null $name = null, mixed|null $default = null) : \Zend\Stdlib\ParametersInterface | mixed
Inherited

Parameters

$name

stringnull

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

$default

mixednull

Default value to use when the parameter is missing.

Returns

\Zend\Stdlib\ParametersInterfacemixed

Get all headers of a certain name/type.

getHeader(string|null $name, mixed|null $default = false) : \Zend\Http\Headers | boolean | \Zend\Http\Header\HeaderInterface | \ArrayIterator
Inherited
see

Parameters

$name

stringnull

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

$default

mixednull

Default value to use when the requested header is missing.

Returns

\Zend\Http\Headersboolean\Zend\Http\Header\HeaderInterface\ArrayIterator

Return the header container responsible for headers

getHeaders() : \Zend\Http\Headers
Inherited

Returns

\Zend\Http\Headers

Return the method for this request

getMethod() : string
Inherited

Returns

string

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

getPost(string|null $name = null, mixed|null $default = null) : \Zend\Stdlib\ParametersInterface | mixed
Inherited

Parameters

$name

stringnull

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

$default

mixednull

Default value to use when the parameter is missing.

Returns

\Zend\Stdlib\ParametersInterfacemixed

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

getQuery(string|null $name = null, mixed|null $default = null) : \Zend\Stdlib\ParametersInterface | mixed
Inherited

Parameters

$name

stringnull

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

$default

mixednull

Default value to use when the parameter is missing.

Returns

\Zend\Stdlib\ParametersInterfacemixed

Get the request URI.

getRequestUri() : string

Returns

string

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

getServer(string|null $name = null, mixed|null $default = null) : \Zend\Stdlib\ParametersInterface | mixed
see

Parameters

$name

stringnull

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

$default

mixednull

Default value to use when the parameter is missing.

Returns

\Zend\Stdlib\ParametersInterfacemixed

Return the URI for this request object

getUri() : \Zend\Uri\Http
Inherited

Returns

\Zend\Uri\Http

Return the URI for this request object as a string

getUriString() : string
Inherited

Returns

string

Return the HTTP version for this request

getVersion() : string
Inherited

Returns

string

Is this a CONNECT method request?

isConnect() : boolean
Inherited

Returns

boolean

Is this a DELETE method request?

isDelete() : boolean
Inherited

Returns

boolean

Is this a Flash request?

isFlashRequest() : boolean
Inherited

Returns

boolean

Is this a GET method request?

isGet() : boolean
Inherited

Returns

boolean

Is this a HEAD method request?

isHead() : boolean
Inherited

Returns

boolean

Is this an OPTIONS method request?

isOptions() : boolean
Inherited

Returns

boolean

Is this a PATCH method request?

isPatch() : boolean
Inherited

Returns

boolean

Is this a POST method request?

isPost() : boolean
Inherited

Returns

boolean

Is this a PROPFIND method request?

isPropFind() : boolean
Inherited

Returns

boolean

Is this a PUT method request?

isPut() : boolean
Inherited

Returns

boolean

Is this a TRACE method request?

isTrace() : boolean
Inherited

Returns

boolean

Is the request a Javascript XMLHttpRequest?

isXmlHttpRequest() : boolean
Inherited

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

Returns

boolean

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

renderRequestLine() : string
Inherited

Returns

string

setAllowCustomMethods()

setAllowCustomMethods(boolean $strictMethods) 
Inherited

Parameters

$strictMethods

boolean

Set the base path.

setBasePath(string $basePath) : \Zend\Http\PhpEnvironment\Request
fluent This method is part of a fluent interface and will return the same instance

Parameters

$basePath

string

Returns

\Zend\Http\PhpEnvironment\Request

Set the base URL.

setBaseUrl(string $baseUrl) : \Zend\Http\PhpEnvironment\Request
fluent This method is part of a fluent interface and will return the same instance

Parameters

$baseUrl

string

Returns

\Zend\Http\PhpEnvironment\Request

Set message content

setContent(mixed $value) : \Zend\Stdlib\Message
Inherited
inherited_from \Zend\Stdlib\MessageInterface::setContent()

Parameters

$value

mixed

Returns

\Zend\Stdlib\Message

Set cookies

setCookies($cookie) : \Zend\Http\PhpEnvironment\Request

Instantiate and set cookies.

Parameters

$cookie

Returns

\Zend\Http\PhpEnvironment\Request

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())

setEnv(\Zend\Stdlib\ParametersInterface $env) : \Zend\Http\PhpEnvironment\Request

Parameters

$env

\Zend\Stdlib\ParametersInterface

Returns

\Zend\Http\PhpEnvironment\Request

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())

setFiles(\Zend\Stdlib\ParametersInterface $files) : \Zend\Http\Request
Inherited

Parameters

$files

\Zend\Stdlib\ParametersInterface

Returns

\Zend\Http\Request

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

setHeaders(\Zend\Http\Headers $headers) : \Zend\Http\AbstractMessage
Inherited
see

Parameters

$headers

\Zend\Http\Headers

Returns

\Zend\Http\AbstractMessage

Set the method for this request

setMethod(string $method) : \Zend\Http\Request
Inherited

Parameters

$method

string

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

\Zend\Http\Request

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())

setPost(\Zend\Stdlib\ParametersInterface $post) : \Zend\Http\Request
Inherited

Parameters

$post

\Zend\Stdlib\ParametersInterface

Returns

\Zend\Http\Request

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())

setQuery(\Zend\Stdlib\ParametersInterface $query) : \Zend\Http\Request
Inherited

Parameters

$query

\Zend\Stdlib\ParametersInterface

Returns

\Zend\Http\Request

Set the request URI.

setRequestUri(string $requestUri) : \Zend\Http\PhpEnvironment\Request
fluent This method is part of a fluent interface and will return the same instance

Parameters

$requestUri

string

Returns

\Zend\Http\PhpEnvironment\Request

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())

setServer(\Zend\Stdlib\ParametersInterface $server) : \Zend\Http\PhpEnvironment\Request

Parameters

$server

\Zend\Stdlib\ParametersInterface

Returns

\Zend\Http\PhpEnvironment\Request

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

setUri(string|\Zend\Uri\Http $uri) : \Zend\Http\Request
Inherited

Parameters

$uri

string\Zend\Uri\Http

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

\Zend\Http\Request

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

setVersion(string $version) : \Zend\Http\AbstractMessage
Inherited

Parameters

$version

string

(Must be 1.0 or 1.1)

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

\Zend\Http\AbstractMessage

toString()

toString() : string
Inherited

Returns

string

Autodetect the base path of the request

detectBasePath() : string

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

Returns

string

Auto-detect the base path from the request environment

detectBaseUrl() : string

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

Detect the base URI for the request

detectRequestUri() : string

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

Returns

string

mapPhpFileParam()

mapPhpFileParam(array $array, string $paramName, integer|string $index, string|array $value) 

Parameters

$array

array

$paramName

string

$index

integerstring

$value

stringarray

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

mapPhpFiles() : array

Returns

array

 Properties

 

$allowCustomMethods

$allowCustomMethods : boolean

Default

true
 

Base Path of the application.

$basePath : string

Default

 

Base URL of the application.

$baseUrl : string

Default

 

$content

$content : string

Default

''
 

PHP environment params ($_ENV)

$envParams : \Zend\Stdlib\ParametersInterface

Default

null
 

$fileParams

$fileParams : \Zend\Stdlib\ParametersInterface

Default

null
 

$headers

$headers : \Zend\Http\Headers | null

Default

null
   

$method

$method : string

Default

self::METHOD_GET
 

$postParams

$postParams : \Zend\Stdlib\ParametersInterface

Default

null
 

$queryParams

$queryParams : \Zend\Stdlib\ParametersInterface

Default

null
 

Actual request URI, independent of the platform.

$requestUri : string

Default

 

PHP server params ($_SERVER)

$serverParams : \Zend\Stdlib\ParametersInterface

Default

null
 

$uri

$uri : string | \Zend\Uri\Http

Default

null
 

$version

$version : string

Default

self::VERSION_11

 Constants

 

METHOD_CONNECT

METHOD_CONNECT = 'CONNECT' 
 

METHOD_DELETE

METHOD_DELETE = 'DELETE' 
 

METHOD_GET

METHOD_GET = 'GET' 
 

METHOD_HEAD

METHOD_HEAD = 'HEAD' 
 

METHOD_OPTIONS

METHOD_OPTIONS = 'OPTIONS' 
 

METHOD_PATCH

METHOD_PATCH = 'PATCH' 
 

METHOD_POST

METHOD_POST = 'POST' 
 

METHOD_PROPFIND

METHOD_PROPFIND = 'PROPFIND' 
 

METHOD_PUT

METHOD_PUT = 'PUT' 
 

METHOD_TRACE

METHOD_TRACE = 'TRACE' 
 

VERSION_10

VERSION_10 = '1.0' 
 

VERSION_11

VERSION_11 = '1.1'