On this page
Request
class Request extends Facade (View source)
Properties
static protected Application | $app | The application instance being facaded. |
from Facade |
static protected array | $resolvedInstance | The resolved object instances. |
from Facade |
static protected bool | $cached | Indicates if the resolved instance should be cached. |
from Facade |
Methods
static void | resolved(Closure $callback) Run a Closure when the facade has been resolved. |
from Facade |
static MockInterface | spy() Convert the facade into a Mockery spy. |
from Facade |
static MockInterface | partialMock() Initiate a partial mock on the facade. |
from Facade |
static Expectation | shouldReceive() Initiate a mock expectation on the facade. |
from Facade |
static Expectation | expects() Initiate a mock expectation on the facade. |
from Facade |
static MockInterface | createFreshMockInstance() Create a fresh mock instance for the given class. |
from Facade |
static MockInterface | createMock() Create a fresh mock instance for the given class. |
from Facade |
static bool | isMock() Determines whether a mock is set as the instance of the facade. |
from Facade |
static string|null | getMockableClass() Get the mockable class for the bound instance. |
from Facade |
static void | swap(mixed $instance) Hotswap the underlying instance behind the facade. |
from Facade |
static bool | isFake() Determines whether a "fake" has been set as the facade instance. |
from Facade |
static mixed | getFacadeRoot() Get the root object behind the facade. |
from Facade |
static string | getFacadeAccessor() Get the registered name of the component. |
|
static mixed | resolveFacadeInstance(string $name) Resolve the facade root instance from the container. |
from Facade |
static void | clearResolvedInstance(string $name) Clear a resolved facade instance. |
from Facade |
static void | clearResolvedInstances() Clear all of the resolved instances. |
from Facade |
static Collection | defaultAliases() Get the application default aliases. |
from Facade |
static Application | getFacadeApplication() Get the application instance behind the facade. |
from Facade |
static void | setFacadeApplication(Application $app) Set the application instance. |
from Facade |
static mixed | __callStatic(string $method, array $args) Handle dynamic, static calls to the object. |
from Facade |
static Request | capture() No description |
|
static Request | instance() No description |
|
static string | method() No description |
|
static string | root() No description |
|
static string | url() No description |
|
static string | fullUrl() No description |
|
static string | fullUrlWithQuery(array $query) No description |
|
static string | fullUrlWithoutQuery(array|string $keys) No description |
|
static string | path() No description |
|
static string | decodedPath() No description |
|
static string|null | segment(int $index, string|null $default = null) No description |
|
static array | segments() No description |
|
static bool | is(mixed $patterns) No description |
|
static bool | routeIs(mixed $patterns) No description |
|
static bool | fullUrlIs(mixed $patterns) No description |
|
static string | host() No description |
|
static string | httpHost() No description |
|
static string | schemeAndHttpHost() No description |
|
static bool | ajax() No description |
|
static bool | pjax() No description |
|
static bool | prefetch() No description |
|
static bool | secure() No description |
|
static string|null | ip() No description |
|
static array | ips() No description |
|
static string|null | userAgent() No description |
|
static Request | merge(array $input) No description |
|
static Request | mergeIfMissing(array $input) No description |
|
static Request | replace(array $input) No description |
|
static mixed | get(string $key, mixed $default = null) No description |
|
static ParameterBag|mixed | json(string|null $key = null, mixed $default = null) No description |
|
static Request | createFrom(Request $from, Request|null $to = null) No description |
|
static Request | createFromBase(Request $request) No description |
|
static Request | duplicate(array|null $query = null, array|null $request = null, array|null $attributes = null, array|null $cookies = null, array|null $files = null, array|null $server = null) No description |
|
static bool | hasSession(bool $skipIfUninitialized = false) No description |
|
static SessionInterface | getSession() No description |
|
static Session | session() No description |
|
static void | setLaravelSession(Session $session) No description |
|
static void | setRequestLocale(string $locale) No description |
|
static void | setDefaultRequestLocale(string $locale) No description |
|
static mixed | user(string|null $guard = null) No description |
|
static Route|object|string|null | route(string|null $param = null, mixed $default = null) No description |
|
static string | fingerprint() No description |
|
static Request | setJson(ParameterBag $json) No description |
|
static Closure | getUserResolver() No description |
|
static Request | setUserResolver(Closure $callback) No description |
|
static Closure | getRouteResolver() No description |
|
static Request | setRouteResolver(Closure $callback) No description |
|
static array | toArray() No description |
|
static void | initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], string|resource|null $content = null) No description |
|
static static | createFromGlobals() No description |
|
static static | create(string $uri, string $method = 'GET', array $parameters = [], array $cookies = [], array $files = [], array $server = [], string|resource|null $content = null) No description |
|
static void | setFactory(callable|null $callable) No description |
|
static void | overrideGlobals() No description |
|
static void | setTrustedProxies(array $proxies, int $trustedHeaderSet) No description |
|
static string[] | getTrustedProxies() No description |
|
static int | getTrustedHeaderSet() No description |
|
static void | setTrustedHosts(array $hostPatterns) No description |
|
static string[] | getTrustedHosts() No description |
|
static string | normalizeQueryString(string|null $qs) No description |
|
static void | enableHttpMethodParameterOverride() No description |
|
static bool | getHttpMethodParameterOverride() No description |
|
static bool | hasPreviousSession() No description |
|
static void | setSession(SessionInterface $session) No description |
|
static array | getClientIps() No description |
|
static string|null | getClientIp() No description |
|
static string | getScriptName() No description |
|
static string | getPathInfo() No description |
|
static string | getBasePath() No description |
|
static string | getBaseUrl() No description |
|
static string | getScheme() No description |
|
static int|string|null | getPort() No description |
|
static string|null | getUser() No description |
|
static string|null | getPassword() No description |
|
static string|null | getUserInfo() No description |
|
static string | getHttpHost() No description |
|
static string | getRequestUri() No description |
|
static string | getSchemeAndHttpHost() No description |
|
static string | getUri() No description |
|
static string | getUriForPath(string $path) No description |
|
static string | getRelativeUriForPath(string $path) No description |
|
static string|null | getQueryString() No description |
|
static bool | isSecure() No description |
|
static string | getHost() No description |
|
static void | setMethod(string $method) No description |
|
static string | getMethod() No description |
|
static string | getRealMethod() No description |
|
static string|null | getMimeType(string $format) No description |
|
static string[] | getMimeTypes(string $format) No description |
|
static string|null | getFormat(string|null $mimeType) No description |
|
static void | setFormat(string|null $format, string|string[] $mimeTypes) No description |
|
static string|null | getRequestFormat(string|null $default = 'html') No description |
|
static void | setRequestFormat(string|null $format) No description |
|
static string|null | getContentTypeFormat() No description |
|
static void | setDefaultLocale(string $locale) No description |
|
static string | getDefaultLocale() No description |
|
static void | setLocale(string $locale) No description |
|
static string | getLocale() No description |
|
static bool | isMethod(string $method) No description |
|
static bool | isMethodSafe() No description |
|
static bool | isMethodIdempotent() No description |
|
static bool | isMethodCacheable() No description |
|
static string|null | getProtocolVersion() No description |
|
static string|resource | getContent(bool $asResource = false) No description |
|
static InputBag | getPayload() No description |
|
static array | getETags() No description |
|
static bool | isNoCache() No description |
|
static string|null | getPreferredFormat(string|null $default = 'html') No description |
|
static string|null | getPreferredLanguage(string[] $locales = null) No description |
|
static string[] | getLanguages() No description |
|
static string[] | getCharsets() No description |
|
static string[] | getEncodings() No description |
|
static string[] | getAcceptableContentTypes() No description |
|
static bool | isXmlHttpRequest() No description |
|
static bool | preferSafeContent() No description |
|
static bool | isFromTrustedProxy() No description |
|
static array | filterPrecognitiveRules(array $rules) No description |
|
static bool | isAttemptingPrecognition() No description |
|
static bool | isPrecognitive() No description |
|
static bool | isJson() No description |
|
static bool | expectsJson() No description |
|
static bool | wantsJson() No description |
|
static bool | accepts(string|array $contentTypes) No description |
|
static string|null | prefers(string|array $contentTypes) No description |
|
static bool | acceptsAnyContentType() No description |
|
static bool | acceptsJson() No description |
|
static bool | acceptsHtml() No description |
|
static bool | matchesType(string $actual, string $type) No description |
|
static string | format(string $default = 'html') No description |
|
static string|array|null | old(string|null $key = null, Model|string|array|null $default = null) No description |
|
static void | flash() No description |
|
static void | flashOnly(array|mixed $keys) No description |
|
static void | flashExcept(array|mixed $keys) No description |
|
static void | flush() No description |
|
static string|array|null | server(string|null $key = null, string|array|null $default = null) No description |
|
static bool | hasHeader(string $key) No description |
|
static string|array|null | header(string|null $key = null, string|array|null $default = null) No description |
|
static string|null | bearerToken() No description |
|
static bool | exists(string|array $key) No description |
|
static bool | has(string|array $key) No description |
|
static bool | hasAny(string|array $keys) No description |
|
static Request|mixed | whenHas(string $key, callable $callback, callable|null $default = null) No description |
|
static bool | filled(string|array $key) No description |
|
static bool | isNotFilled(string|array $key) No description |
|
static bool | anyFilled(string|array $keys) No description |
|
static Request|mixed | whenFilled(string $key, callable $callback, callable|null $default = null) No description |
|
static bool | missing(string|array $key) No description |
|
static Request|mixed | whenMissing(string $key, callable $callback, callable|null $default = null) No description |
|
static array | keys() No description |
|
static array | all(array|mixed|null $keys = null) No description |
|
static mixed | input(string|null $key = null, mixed $default = null) No description |
|
static Stringable | str(string $key, mixed $default = null) No description |
|
static Stringable | string(string $key, mixed $default = null) No description |
|
static bool | boolean(string|null $key = null, bool $default = false) No description |
|
static int | integer(string $key, int $default) No description |
|
static float | float(string $key, float $default) No description |
|
static Carbon|null | date(string $key, string|null $format = null, string|null $tz = null) No description |
|
static object|null | enum(string $key, string $enumClass) No description |
|
static Collection | collect(array|string|null $key = null) No description |
|
static array | only(array|mixed $keys) No description |
|
static array | except(array|mixed $keys) No description |
|
static string|array|null | query(string|null $key = null, string|array|null $default = null) No description |
|
static string|array|null | post(string|null $key = null, string|array|null $default = null) No description |
|
static bool | hasCookie(string $key) No description |
|
static string|array|null | cookie(string|null $key = null, string|array|null $default = null) No description |
|
static array | allFiles() No description |
|
static bool | hasFile(string $key) No description |
|
static UploadedFile[]|array|null | file(string|null $key = null, mixed $default = null) No description |
|
static never | dd(mixed $keys) No description |
|
static Request | dump(mixed $keys = []) No description |
|
static void | macro(string $name, object|callable $macro) No description |
|
static void | mixin(object $mixin, bool $replace = true) No description |
|
static bool | hasMacro(string $name) No description |
|
static void | flushMacros() No description |
|
static array | validate(array $rules, mixed $params) No description |
|
static array | validateWithBag(string $errorBag, array $rules, mixed $params) No description |
|
static bool | hasValidSignature(bool $absolute = true) No description |
Details
static void resolved(Closure $callback)
Run a Closure when the facade has been resolved.
static MockInterface spy()
Convert the facade into a Mockery spy.
static MockInterface partialMock()
Initiate a partial mock on the facade.
static Expectation shouldReceive()
Initiate a mock expectation on the facade.
static Expectation expects()
Initiate a mock expectation on the facade.
static protected MockInterface createFreshMockInstance()
Create a fresh mock instance for the given class.
static protected MockInterface createMock()
Create a fresh mock instance for the given class.
static protected bool isMock()
Determines whether a mock is set as the instance of the facade.
static protected string|null getMockableClass()
Get the mockable class for the bound instance.
static void swap(mixed $instance)
Hotswap the underlying instance behind the facade.
static protected bool isFake()
Determines whether a "fake" has been set as the facade instance.
static mixed getFacadeRoot()
Get the root object behind the facade.
static protected string getFacadeAccessor()
Get the registered name of the component.
static protected mixed resolveFacadeInstance(string $name)
Resolve the facade root instance from the container.
static void clearResolvedInstance(string $name)
Clear a resolved facade instance.
static void clearResolvedInstances()
Clear all of the resolved instances.
static Collection defaultAliases()
Get the application default aliases.
static Application getFacadeApplication()
Get the application instance behind the facade.
static void setFacadeApplication(Application $app)
Set the application instance.
static mixed __callStatic(string $method, array $args)
Handle dynamic, static calls to the object.
static Request capture()
No description
static Request instance()
No description
static string method()
No description
static string root()
No description
static string url()
No description
static string fullUrl()
No description
static string fullUrlWithQuery(array $query)
No description
static string fullUrlWithoutQuery(array|string $keys)
No description
static string path()
No description
static string decodedPath()
No description
static string|null segment(int $index, string|null $default = null)
No description
static array segments()
No description
static bool is(mixed $patterns)
No description
static bool routeIs(mixed $patterns)
No description
static bool fullUrlIs(mixed $patterns)
No description
static string host()
No description
static string httpHost()
No description
static string schemeAndHttpHost()
No description
static bool ajax()
No description
static bool pjax()
No description
static bool prefetch()
No description
static bool secure()
No description
static string|null ip()
No description
static array ips()
No description
static string|null userAgent()
No description
static Request merge(array $input)
No description
static Request mergeIfMissing(array $input)
No description
static Request replace(array $input)
No description
static mixed get(string $key, mixed $default = null)
No description
static ParameterBag|mixed json(string|null $key = null, mixed $default = null)
No description
static Request createFromBase(Request $request)
No description
static Request duplicate(array|null $query = null, array|null $request = null, array|null $attributes = null, array|null $cookies = null, array|null $files = null, array|null $server = null)
No description
static bool hasSession(bool $skipIfUninitialized = false)
No description
static SessionInterface getSession()
No description
static Session session()
No description
static void setLaravelSession(Session $session)
No description
static void setRequestLocale(string $locale)
No description
static void setDefaultRequestLocale(string $locale)
No description
static mixed user(string|null $guard = null)
No description
static Route|object|string|null route(string|null $param = null, mixed $default = null)
No description
static string fingerprint()
No description
static Request setJson(ParameterBag $json)
No description
static Closure getUserResolver()
No description
static Closure getRouteResolver()
No description
static array toArray()
No description
static void initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], string|resource|null $content = null)
No description
static static createFromGlobals()
No description
static static create(string $uri, string $method = 'GET', array $parameters = [], array $cookies = [], array $files = [], array $server = [], string|resource|null $content = null)
No description
static void setFactory(callable|null $callable)
No description
static void overrideGlobals()
No description
static void setTrustedProxies(array $proxies, int $trustedHeaderSet)
No description
static string[] getTrustedProxies()
No description
static int getTrustedHeaderSet()
No description
static void setTrustedHosts(array $hostPatterns)
No description
static string[] getTrustedHosts()
No description
static string normalizeQueryString(string|null $qs)
No description
static void enableHttpMethodParameterOverride()
No description
static bool getHttpMethodParameterOverride()
No description
static bool hasPreviousSession()
No description
static void setSession(SessionInterface $session)
No description
static array getClientIps()
No description
static string|null getClientIp()
No description
static string getScriptName()
No description
static string getPathInfo()
No description
static string getBasePath()
No description
static string getBaseUrl()
No description
static string getScheme()
No description
static int|string|null getPort()
No description
static string|null getUser()
No description
static string|null getPassword()
No description
static string|null getUserInfo()
No description
static string getHttpHost()
No description
static string getRequestUri()
No description
static string getSchemeAndHttpHost()
No description
static string getUri()
No description
static string getUriForPath(string $path)
No description
static string getRelativeUriForPath(string $path)
No description
static string|null getQueryString()
No description
static bool isSecure()
No description
static string getHost()
No description
static void setMethod(string $method)
No description
static string getMethod()
No description
static string getRealMethod()
No description
static string|null getMimeType(string $format)
No description
static string[] getMimeTypes(string $format)
No description
static string|null getFormat(string|null $mimeType)
No description
static void setFormat(string|null $format, string|string[] $mimeTypes)
No description
static string|null getRequestFormat(string|null $default = 'html')
No description
static void setRequestFormat(string|null $format)
No description
static string|null getContentTypeFormat()
No description
static void setDefaultLocale(string $locale)
No description
static string getDefaultLocale()
No description
static void setLocale(string $locale)
No description
static string getLocale()
No description
static bool isMethod(string $method)
No description
static bool isMethodSafe()
No description
static bool isMethodIdempotent()
No description
static bool isMethodCacheable()
No description
static string|null getProtocolVersion()
No description
static string|resource getContent(bool $asResource = false)
No description
static InputBag getPayload()
No description
static array getETags()
No description
static bool isNoCache()
No description
static string|null getPreferredFormat(string|null $default = 'html')
No description
static string|null getPreferredLanguage(string[] $locales = null)
No description
static string[] getLanguages()
No description
static string[] getCharsets()
No description
static string[] getEncodings()
No description
static string[] getAcceptableContentTypes()
No description
static bool isXmlHttpRequest()
No description
static bool preferSafeContent()
No description
static bool isFromTrustedProxy()
No description
static array filterPrecognitiveRules(array $rules)
No description
static bool isAttemptingPrecognition()
No description
static bool isPrecognitive()
No description
static bool isJson()
No description
static bool expectsJson()
No description
static bool wantsJson()
No description
static bool accepts(string|array $contentTypes)
No description
static string|null prefers(string|array $contentTypes)
No description
static bool acceptsAnyContentType()
No description
static bool acceptsJson()
No description
static bool acceptsHtml()
No description
static bool matchesType(string $actual, string $type)
No description
static string format(string $default = 'html')
No description
static string|array|null old(string|null $key = null, Model|string|array|null $default = null)
No description
static void flash()
No description
static void flashOnly(array|mixed $keys)
No description
static void flashExcept(array|mixed $keys)
No description
static void flush()
No description
static string|array|null server(string|null $key = null, string|array|null $default = null)
No description
static bool hasHeader(string $key)
No description
static string|array|null header(string|null $key = null, string|array|null $default = null)
No description
static string|null bearerToken()
No description
static bool exists(string|array $key)
No description
static bool has(string|array $key)
No description
static bool hasAny(string|array $keys)
No description
static Request|mixed whenHas(string $key, callable $callback, callable|null $default = null)
No description
static bool filled(string|array $key)
No description
static bool isNotFilled(string|array $key)
No description
static bool anyFilled(string|array $keys)
No description
static Request|mixed whenFilled(string $key, callable $callback, callable|null $default = null)
No description
static bool missing(string|array $key)
No description
static Request|mixed whenMissing(string $key, callable $callback, callable|null $default = null)
No description
static array keys()
No description
static array all(array|mixed|null $keys = null)
No description
static mixed input(string|null $key = null, mixed $default = null)
No description
static Stringable str(string $key, mixed $default = null)
No description
static Stringable string(string $key, mixed $default = null)
No description
static bool boolean(string|null $key = null, bool $default = false)
No description
static int integer(string $key, int $default)
No description
static float float(string $key, float $default)
No description
static Carbon|null date(string $key, string|null $format = null, string|null $tz = null)
No description
static object|null enum(string $key, string $enumClass)
No description
static Collection collect(array|string|null $key = null)
No description
static array only(array|mixed $keys)
No description
static array except(array|mixed $keys)
No description
static string|array|null query(string|null $key = null, string|array|null $default = null)
No description
static string|array|null post(string|null $key = null, string|array|null $default = null)
No description
static bool hasCookie(string $key)
No description
static string|array|null cookie(string|null $key = null, string|array|null $default = null)
No description
static array allFiles()
No description
static bool hasFile(string $key)
No description
static UploadedFile[]|array|null file(string|null $key = null, mixed $default = null)
No description
static never dd(mixed $keys)
No description
static Request dump(mixed $keys = [])
No description
static void macro(string $name, object|callable $macro)
No description
static void mixin(object $mixin, bool $replace = true)
No description
static bool hasMacro(string $name)
No description
static void flushMacros()
No description
static array validate(array $rules, mixed $params)
No description
static array validateWithBag(string $errorBag, array $rules, mixed $params)
No description
static bool hasValidSignature(bool $absolute = true)
No description
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Support/Facades/Request.html