Symfony\Component\HttpFoundation\Request
Request represents an HTTP request.
The methods dealing with URL accept / return a raw path (% encoded):
* getBasePath
* getBaseUrl
* getPathInfo
* getRequestUri
* getUri
* getUriForPath
- Author: Fabien Potencier <fabien@symfony.com>
Synopsis
class Request
{
- // constants
- const HEADER_CLIENT_IP = 'client_ip';
- const HEADER_CLIENT_HOST = 'client_host';
- const HEADER_CLIENT_PROTO = 'client_proto';
- const HEADER_CLIENT_PORT = 'client_port';
- // members
- protected array $trustedProxies;
- protected array $trustedHeaders;
- protected $httpMethodParameterOverride;
- public ParameterBag $attributes;
- public ParameterBag $request;
- public ParameterBag $query;
- public ServerBag $server;
- public FileBag $files;
- public ParameterBag $cookies;
- public HeaderBag $headers;
- protected string $content;
- protected array $languages;
- protected array $charsets;
- protected array $acceptableContentTypes;
- protected string $pathInfo;
- protected string $requestUri;
- protected string $baseUrl;
- protected string $basePath;
- protected string $method;
- protected string $format;
- protected SessionInterface $session;
- protected string $locale;
- protected string $defaultLocale;
- protected array $formats;
- // methods
- public void __construct()
- public void initialize()
- public static Request createFromGlobals()
- public static Request create()
- public Request duplicate()
- public void __clone()
- public string __toString()
- public void overrideGlobals()
- public static void setTrustedProxies()
- public static array getTrustedProxies()
- public static void setTrustedHeaderName()
- public static string getTrustedHeaderName()
- public static string normalizeQueryString()
- public static void enableHttpMethodParameterOverride()
- public static Boolean getHttpMethodParameterOverride()
- public mixed get()
- public SessionInterface|null getSession()
- public Boolean hasPreviousSession()
- public Boolean hasSession()
- public void setSession()
- public array getClientIps()
- public string getClientIp()
- public string getScriptName()
- public string getPathInfo()
- public string getBasePath()
- public string getBaseUrl()
- public string getScheme()
- public string getPort()
- public string|null getUser()
- public string|null getPassword()
- public string getUserInfo()
- public string getHttpHost()
- public string getRequestUri()
- public string getSchemeAndHttpHost()
- public string getUri()
- public string getUriForPath()
- public string|null getQueryString()
- public Boolean isSecure()
- public string getHost()
- public void setMethod()
- public string getMethod()
- public string getRealMethod()
- public string getMimeType()
- public string|null getFormat()
- public void setFormat()
- public string getRequestFormat()
- public void setRequestFormat()
- public string|null getContentType()
- public void setDefaultLocale()
- public void setLocale()
- public string getLocale()
- public Boolean isMethod()
- public Boolean isMethodSafe()
- public string|resource getContent()
- public array getETags()
- public Boolean isNoCache()
- public string|null getPreferredLanguage()
- public array getLanguages()
- public array getCharsets()
- public array getAcceptableContentTypes()
- public Boolean isXmlHttpRequest()
- protected void prepareRequestUri()
- protected string prepareBaseUrl()
- protected string prepareBasePath()
- protected string preparePathInfo()
- protected static void initializeFormats()
- private void setPhpDefaultLocale()
- private void getUrlencodedPrefix()
Hierarchy
Extended by
Constants
Name | Value |
---|---|
HEADER_CLIENT_IP | 'client_ip' |
HEADER_CLIENT_HOST | 'client_host' |
HEADER_CLIENT_PROTO | 'client_proto' |
HEADER_CLIENT_PORT | 'client_port' |
Members
protected
- $acceptableContentTypes — array
- $basePath — string
- $baseUrl — string
- $charsets — array
- $content — string
- $defaultLocale — string
- $format — string
- $formats — array
- $httpMethodParameterOverride
- $languages — array
- $locale — string
- $method — string
- $pathInfo — string
- $requestUri — string
- $session — \Symfony\Component\HttpFoundation\Session\SessionInterface
-
$trustedHeaders
Names for headers that can be trusted when using trusted proxies. - $trustedProxies
public
- $attributes — \Symfony\Component\HttpFoundation\ParameterBag
- $files — \Symfony\Component\HttpFoundation\FileBag
- $headers — \Symfony\Component\HttpFoundation\HeaderBag
- $query — \Symfony\Component\HttpFoundation\ParameterBag
- $request — \Symfony\Component\HttpFoundation\ParameterBag
- $server — \Symfony\Component\HttpFoundation\ServerBag
Methods
private
- getUrlencodedPrefix()
- setPhpDefaultLocale() — Sets the default PHP locale.
protected
- initializeFormats() — Initializes HTTP request formats.
- prepareBasePath() — Prepares the base path.
- prepareBaseUrl() — Prepares the base URL.
- preparePathInfo() — Prepares the path info.
- prepareRequestUri()
public
- __construct() — Constructor.
- __clone() — Clones the current request.
- __toString() — Returns the request as a string.
- create() — Creates a Request based on a given URI and configuration.
- createFromGlobals() — Creates a new request with values from PHP's super globals.
- duplicate() — Clones a request and overrides some of its parameters.
- enableHttpMethodParameterOverride() — Enables support for the _method request parameter to determine the intended HTTP method.
- get() — Gets a "parameter" value.
- getAcceptableContentTypes() — Gets a list of content types acceptable by the client browser
- getBasePath() — Returns the root path from which this request is executed.
- getBaseUrl() — Returns the root url from which this request is executed.
- getCharsets() — Gets a list of charsets acceptable by the client browser.
- getClientIp() — Returns the client IP address.
- getClientIps() — Returns the client IP addresses.
- getContent() — Returns the request body content.
- getContentType() — Gets the format associated with the request.
- getETags() — Gets the Etags.
- getFormat() — Gets the format associated with the mime type.
- getHost() — Returns the host name.
- getHttpHost() — Returns the HTTP host being requested.
- getHttpMethodParameterOverride() — Checks whether support for the _method request parameter is enabled.
- getLanguages() — Gets a list of languages acceptable by the client browser.
- getLocale() — Get the locale.
- getMethod() — Gets the request "intended" method.
- getMimeType() — Gets the mime type associated with the format.
- getPassword() — Returns the password.
- getPathInfo() — Returns the path being requested relative to the executed script.
- getPort() — Returns the port on which the request is made.
- getPreferredLanguage() — Returns the preferred language.
- getQueryString() — Generates the normalized query string for the Request.
- getRealMethod() — Gets the "real" request method.
- getRequestFormat() — Gets the request format.
- getRequestUri() — Returns the requested URI.
- getScheme() — Gets the request's scheme.
- getSchemeAndHttpHost() — Gets the scheme and HTTP host.
- getScriptName() — Returns current script name.
- getSession() — Gets the Session.
- getTrustedHeaderName() — Gets the trusted proxy header name.
- getTrustedProxies() — Gets the list of trusted proxies.
- getUri() — Generates a normalized URI for the Request.
- getUriForPath() — Generates a normalized URI for the given path.
- getUser() — Returns the user.
- getUserInfo() — Gets the user info.
- hasPreviousSession() — Whether the request contains a Session which was started in one of the previous requests.
- hasSession() — Whether the request contains a Session object.
- initialize() — Sets the parameters for this request.
- isMethod() — Checks if the request method is of specified type.
- isMethodSafe() — Checks whether the method is safe or not.
- isNoCache()
- isSecure() — Checks whether the request is secure or not.
- isXmlHttpRequest() — Returns true if the request is a XMLHttpRequest.
- normalizeQueryString() — Normalizes a query string.
- overrideGlobals() — Overrides the PHP global variables according to this request instance.
- setDefaultLocale() — Sets the default locale.
- setFormat() — Associates a format with mime types.
- setLocale() — Sets the locale.
- setMethod() — Sets the request method.
- setRequestFormat() — Sets the request format.
- setSession() — Sets the Session.
- setTrustedHeaderName() — Sets the name for trusted headers.
- setTrustedProxies() — Sets a list of trusted proxies.