Property | Type | Description | |
---|---|---|---|
$attributes | Symfony\Component\HttpFoundation\ParameterBag | Custom parameters. | |
$cookies | Symfony\Component\HttpFoundation\ParameterBag | Cookies ($_COOKIE). | |
$files | Uploaded files ($_FILES). | ||
$headers | Headers (taken from the $_SERVER). | ||
$query | Symfony\Component\HttpFoundation\ParameterBag | Query string parameters ($_GET). | |
$request | Symfony\Component\HttpFoundation\ParameterBag | Request body parameters ($_POST). | |
$server | Server and execution environment parameters ($_SERVER). |
Property | Type | Description | |
---|---|---|---|
$acceptableContentTypes | array | ||
$basePath | string | ||
$baseUrl | string | ||
$charsets | array | ||
$content | string | ||
$defaultLocale | string | ||
$encodings | array | ||
$format | string | ||
$formats | array | ||
$httpMethodParameterOverride | |||
$languages | array | ||
$locale | string | ||
$method | string | ||
$pathInfo | string | ||
$requestFactory | |||
$requestUri | string | ||
$session | Symfony\Component\HttpFoundation\Session\SessionInterface | ||
$trustedHeaders | The FORWARDED header is the standard as of rfc7239. The other headers are non-standard, but widely used by popular reverse proxies (like Apache mod_proxy or Amazon EC2). | ||
$trustedHostPatterns | string[] | ||
$trustedHosts | string[] | ||
$trustedProxies | string[] |
Method | Description | |
---|---|---|
__clone ( ) | Clones the current request. | |
__construct ( array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], string | resource $content = null ) | Constructor. | |
__toString ( ) : string | Returns the request as a string. | |
create ( string $uri, string $method = 'GET', array $parameters = [], array $cookies = [], array $files = [], array $server = [], string $content = null ) : |
Creates a Request based on a given URI and configuration. | |
createFromGlobals ( ) : |
Creates a new request with values from PHP's super globals. | |
duplicate ( array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null ) : |
Clones a request and overrides some of its parameters. | |
enableHttpMethodParameterOverride ( ) | Enables support for the _method request parameter to determine the intended HTTP method. | |
get ( string $key, mixed $default = null ) : mixed | Gets a "parameter" value from any bag. | |
getAcceptableContentTypes ( ) : array | Gets a list of content types acceptable by the client browser. | |
getBasePath ( ) : string | Returns the root path from which this request is executed. | |
getBaseUrl ( ) : string | Returns the root URL from which this request is executed. | |
getCharsets ( ) : array | Gets a list of charsets acceptable by the client browser. | |
getClientIp ( ) : string | Returns the client IP address. | |
getClientIps ( ) : array | Returns the client IP addresses. | |
getContent ( boolean $asResource = false ) : string | resource | Returns the request body content. | |
getContentType ( ) : string | null | Gets the format associated with the request. | |
getDefaultLocale ( ) : string | Get the default locale. | |
getETags ( ) : array | Gets the Etags. | |
getEncodings ( ) : array | Gets a list of encodings acceptable by the client browser. | |
getFormat ( string $mimeType ) : string | null | Gets the format associated with the mime type. | |
getHost ( ) : string | Returns the host name. | |
getHttpHost ( ) : string | Returns the HTTP host being requested. | |
getHttpMethodParameterOverride ( ) : boolean | Checks whether support for the _method request parameter is enabled. | |
getLanguages ( ) : array | Gets a list of languages acceptable by the client browser. | |
getLocale ( ) : string | Get the locale. | |
getMethod ( ) : string | Gets the request "intended" method. | |
getMimeType ( string $format ) : string | Gets the mime type associated with the format. | |
getMimeTypes ( string $format ) : array | Gets the mime types associated with the format. | |
getPassword ( ) : string | null | Returns the password. | |
getPathInfo ( ) : string | Returns the path being requested relative to the executed script. | |
getPort ( ) : string | Returns the port on which the request is made. | |
getPreferredLanguage ( array $locales = null ) : string | null | Returns the preferred language. | |
getQueryString ( ) : string | null | Generates the normalized query string for the Request. | |
getRealMethod ( ) : string | Gets the "real" request method. | |
getRelativeUriForPath ( string $path ) : string | Returns the path as relative reference from the current Request path. | |
getRequestFormat ( string $default = 'html' ) : string | Gets the request format. | |
getRequestUri ( ) : string | Returns the requested URI (path and query string). | |
getScheme ( ) : string | Gets the request's scheme. | |
getSchemeAndHttpHost ( ) : string | Gets the scheme and HTTP host. | |
getScriptName ( ) : string | Returns current script name. | |
getSession ( ) : Symfony\Component\HttpFoundation\Session\SessionInterface | null | Gets the Session. | |
getTrustedHeaderName ( string $key ) : string | Gets the trusted proxy header name. | |
getTrustedHosts ( ) : array | Gets the list of trusted host patterns. | |
getTrustedProxies ( ) : array | Gets the list of trusted proxies. | |
getUri ( ) : string | Generates a normalized URI (URL) for the Request. | |
getUriForPath ( string $path ) : string | Generates a normalized URI for the given path. | |
getUser ( ) : string | null | Returns the user. | |
getUserInfo ( ) : string | Gets the user info. | |
hasPreviousSession ( ) : boolean | Whether the request contains a Session which was started in one of the previous requests. | |
hasSession ( ) : boolean | Whether the request contains a Session object. | |
initialize ( array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], string | resource $content = null ) | Sets the parameters for this request. | |
isFromTrustedProxy ( ) : boolean | Indicates whether this request originated from a trusted proxy. | |
isMethod ( string $method ) : boolean | Checks if the request method is of specified type. | |
isMethodCacheable ( ) : boolean | Checks whether the method is cacheable or not. | |
isMethodIdempotent ( ) : boolean | Checks whether or not the method is idempotent. | |
isMethodSafe ( ) : boolean | Checks whether or not the method is safe. | |
isNoCache ( ) : boolean | ||
isSecure ( ) : boolean | Checks whether the request is secure or not. | |
isXmlHttpRequest ( ) : boolean | Returns true if the request is a XMLHttpRequest. | |
normalizeQueryString ( string $qs ) : string | Normalizes a query string. | |
overrideGlobals ( ) | Overrides the PHP global variables according to this request instance. | |
setDefaultLocale ( string $locale ) | Sets the default locale. | |
setFactory ( callable | null $callable ) | Sets a callable able to create a Request instance. | |
setFormat ( string $format, string | array $mimeTypes ) | Associates a format with mime types. | |
setLocale ( string $locale ) | Sets the locale. | |
setMethod ( string $method ) | Sets the request method. | |
setRequestFormat ( string $format ) | Sets the request format. | |
setSession ( Symfony\Component\HttpFoundation\Session\SessionInterface $session ) | Sets the Session. | |
setTrustedHeaderName ( string $key, string $value ) | Sets the name for trusted headers. | |
setTrustedHosts ( array $hostPatterns ) | Sets a list of trusted host patterns. | |
setTrustedProxies ( array $proxies ) | Sets a list of trusted proxies. |
Method | Description | |
---|---|---|
initializeFormats ( ) | Initializes HTTP request formats. | |
prepareBasePath ( ) : string | Prepares the base path. | |
prepareBaseUrl ( ) : string | Prepares the base URL. | |
preparePathInfo ( ) : string | Prepares the path info. | |
prepareRequestUri ( ) | * The following methods are derived from code of the Zend Framework (1.10dev - 2010-01-24) |
Method | Description | |
---|---|---|
createRequestFromFactory ( array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null ) | ||
getUrlencodedPrefix ( $string, $prefix ) | * Returns the prefix as encoded in the string when the string starts with the given prefix, false otherwise. | |
normalizeAndFilterClientIps ( array $clientIps, $ip ) | ||
setPhpDefaultLocale ( string $locale ) | Sets the default PHP locale. |
public __clone ( ) |
public __construct ( array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], string | resource $content = null ) | ||
$query | array | The GET parameters |
$request | array | The POST parameters |
$attributes | array | The request attributes (parameters parsed from the PATH_INFO, ...) |
$cookies | array | The COOKIE parameters |
$files | array | The FILES parameters |
$server | array | The SERVER parameters |
$content | string | resource | The raw body data |
public __toString ( ) : string | ||
return | string | The request |
public static create ( string $uri, string $method = 'GET', array $parameters = [], array $cookies = [], array $files = [], array $server = [], string $content = null ) : |
||
$uri | string | The URI |
$method | string | The HTTP method |
$parameters | array | The query (GET) or request (POST) parameters |
$cookies | array | The request cookies ($_COOKIE) |
$files | array | The request files ($_FILES) |
$server | array | The server parameters ($_SERVER) |
$content | string | The raw body data |
return | A Request instance |
public static createFromGlobals ( ) : |
||
return | A new request |
public duplicate ( array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null ) : |
||
$query | array | The GET parameters |
$request | array | The POST parameters |
$attributes | array | The request attributes (parameters parsed from the PATH_INFO, ...) |
$cookies | array | The COOKIE parameters |
$files | array | The FILES parameters |
$server | array | The SERVER parameters |
return | The duplicated request |
public static enableHttpMethodParameterOverride ( ) |
public getAcceptableContentTypes ( ) : array | ||
return | array | List of content types in preferable order |
public getBasePath ( ) : string | ||
return | string | The raw path (i.e. not urldecoded) |
public getBaseUrl ( ) : string | ||
return | string | The raw URL (i.e. not urldecoded) |
public getCharsets ( ) : array | ||
return | array | List of charsets in preferable order |
public getClientIp ( ) : string | ||
return | string | The client IP address |
public getClientIps ( ) : array | ||
return | array | The client IP addresses |
public getContent ( boolean $asResource = false ) : string | resource | ||
$asResource | boolean | If true, a resource will be returned |
return | string | resource | The request body content or a resource to read the body stream |
public getContentType ( ) : string | null | ||
return | string | null | The format (null if no content type is present) |
public getDefaultLocale ( ) : string | ||
return | string |
public getEncodings ( ) : array | ||
return | array | List of encodings in preferable order |
public getHttpHost ( ) : string | ||
return | string |
public static getHttpMethodParameterOverride ( ) : boolean | ||
return | boolean | True when the _method request parameter is enabled, false otherwise |
public getLanguages ( ) : array | ||
return | array | Languages ordered in the user browser preferences |
public getMimeType ( string $format ) : string | ||
$format | string | The format |
return | string | The associated mime type (null if not found) |
public static getMimeTypes ( string $format ) : array | ||
$format | string | The format |
return | array | The associated mime types |
public getPassword ( ) : string | null | ||
return | string | null |
public getPathInfo ( ) : string | ||
return | string | The raw path (i.e. not urldecoded) |
public getQueryString ( ) : string | null | ||
return | string | null | A normalized query string for the Request |
public getRealMethod ( ) : string | ||
return | string | The request method |
public getRelativeUriForPath ( string $path ) : string | ||
$path | string | The target path |
return | string | The relative target path |
public getRequestFormat ( string $default = 'html' ) : string | ||
$default | string | The default format |
return | string | The request format |
public getRequestUri ( ) : string | ||
return | string | The raw URI (i.e. not URI decoded) |
public getSchemeAndHttpHost ( ) : string | ||
return | string | The scheme and HTTP host |
public getScriptName ( ) : string | ||
return | string |
public getSession ( ) : Symfony\Component\HttpFoundation\Session\SessionInterface | null | ||
return | Symfony\Component\HttpFoundation\Session\SessionInterface | null | The session |
public static getTrustedHeaderName ( string $key ) : string | ||
$key | string | The header key |
return | string | The header name |
public static getTrustedHosts ( ) : array | ||
return | array | An array of trusted host patterns |
public static getTrustedProxies ( ) : array | ||
return | array | An array of trusted proxies |
public getUriForPath ( string $path ) : string | ||
$path | string | A path to use instead of the current one |
return | string | The normalized URI for the path |
public getUserInfo ( ) : string | ||
return | string | A user name and, optionally, scheme-specific information about how to gain authorization to access the server |
public hasPreviousSession ( ) : boolean | ||
return | boolean |
public hasSession ( ) : boolean | ||
return | boolean | true when the Request contains a Session object, false otherwise |
public initialize ( array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], string | resource $content = null ) | ||
$query | array | The GET parameters |
$request | array | The POST parameters |
$attributes | array | The request attributes (parameters parsed from the PATH_INFO, ...) |
$cookies | array | The COOKIE parameters |
$files | array | The FILES parameters |
$server | array | The SERVER parameters |
$content | string | resource | The raw body data |
protected static initializeFormats ( ) |
public isFromTrustedProxy ( ) : boolean | ||
return | boolean | true if the request came from a trusted proxy, false otherwise |
public isMethodCacheable ( ) : boolean | ||
return | boolean |
public isMethodIdempotent ( ) : boolean | ||
return | boolean |
public isMethodSafe ( ) : boolean | ||
return | boolean |
public isXmlHttpRequest ( ) : boolean | ||
return | boolean | true if the request is an XMLHttpRequest, false otherwise |
public static normalizeQueryString ( string $qs ) : string | ||
$qs | string | Query string |
return | string | A normalized query string for the Request |
public overrideGlobals ( ) |
protected prepareBasePath ( ) : string | ||
return | string | base path |
protected prepareBaseUrl ( ) : string | ||
return | string |
protected preparePathInfo ( ) : string | ||
return | string | path info |
protected prepareRequestUri ( ) |
public setDefaultLocale ( string $locale ) | ||
$locale | string |
public static setFactory ( callable | null $callable ) | ||
$callable | callable | null | A PHP callable |
public setRequestFormat ( string $format ) | ||
$format | string | The request format |
public setSession ( Symfony\Component\HttpFoundation\Session\SessionInterface $session ) | ||
$session | Symfony\Component\HttpFoundation\Session\SessionInterface | The Session |
public static setTrustedHeaderName ( string $key, string $value ) | ||
$key | string | The header key |
$value | string | The header name |
public static setTrustedHosts ( array $hostPatterns ) | ||
$hostPatterns | array | A list of trusted host patterns |
public static setTrustedProxies ( array $proxies ) | ||
$proxies | array | A list of trusted proxies |
public ParameterBag,Symfony\Component\HttpFoundation $attributes | ||
return | Symfony\Component\HttpFoundation\ParameterBag |
public ParameterBag,Symfony\Component\HttpFoundation $cookies | ||
return | Symfony\Component\HttpFoundation\ParameterBag |
public FileBag,Symfony\Component\HttpFoundation $files | ||
return |
public HeaderBag,Symfony\Component\HttpFoundation $headers | ||
return |
protected static $httpMethodParameterOverride |
public ParameterBag,Symfony\Component\HttpFoundation $query | ||
return | Symfony\Component\HttpFoundation\ParameterBag |
public ParameterBag,Symfony\Component\HttpFoundation $request | ||
return | Symfony\Component\HttpFoundation\ParameterBag |
public ServerBag,Symfony\Component\HttpFoundation $server | ||
return |
protected SessionInterface,Symfony\Component\HttpFoundation\Session $session | ||
return | Symfony\Component\HttpFoundation\Session\SessionInterface |
protected static $trustedHeaders |
protected static string[] $trustedHostPatterns | ||
return | string[] |
protected static string[] $trustedHosts | ||
return | string[] |