class JsonApiRequest extends Request

Traits

Constants

protected FORWARDED_PARAMS

Forwarded-header parameter mapping.

protected TRUSTED_HEADERS

Mapping of trusted-header bitmask flags to header names.

Properties

static protected array $macros

The registered string macros.

from  Macroable
protected InputBag|null $json

The decoded JSON content for the request.

from  Request
protected null|UploadedFile|UploadedFile[]> $convertedFiles

All of the converted files for the request.

from  Request
protected Closure|null $userResolver

The user resolver callback.

from  Request
protected Closure|null $routeResolver

The route resolver callback.

from  Request
protected string|null $cachedAcceptHeader

The cached "Accept" header value.

from  Request
protected string[] $trustedProxiesValue

Trusted proxy IP addresses / CIDR ranges for the current request.

from  Request
protected int $trustedHeaderSetValue

Bitmask of trusted forwarded-headers for the current request.

from  Request
protected string[] $trustedHostPatternsValue

Compiled trusted-host regex patterns for the current request.

from  Request
protected string[] $trustedHostsValue

Memoized cache of host strings that matched a trusted pattern.

from  Request
protected array<string, array> $trustedValuesCacheValue

Memoized cache of parsed trusted-header values for this request.

from  Request
protected bool $isHostValidValue

One-shot flag preventing duplicate "Suspicious Host" exceptions per request.

from  Request
protected bool $isForwardedValidValue

One-shot flag preventing duplicate "ConflictingHeaders" exceptions per request.

from  Request
protected array|null $cachedSparseFields

Cached sparse fieldset.

protected array|null $cachedSparseIncluded

Cached sparse included.

Methods

array
filterPrecognitiveRules(array $rules)

Filter the given array of rules into an array of rules that are included in precognitive headers.

bool
shouldValidatePrecognitiveAttribute(string $attribute, array $validateOnly)

Determine if the given attribute should be validated.

bool
isAttemptingPrecognition()

Determine if the request is attempting to be precognitive.

bool
isPrecognitive()

Determine if the request is precognitive.

bool
isJson()

Determine if the request is sending JSON.

bool
expectsJson()

Determine if the current request probably expects a JSON response.

bool
wantsJson()

Determine if the current request is asking for JSON.

bool
wantsMarkdown()

Determine if the current request is asking for Markdown.

bool
accepts(string|array $contentTypes)

Determine whether the current requests accepts a given content type.

string|null
prefers(string|array $contentTypes)

Return the most suitable content type from the given array based on content negotiation.

bool
acceptsAnyContentType()

Determine if the current request accepts any content type.

bool
acceptsJson()

Determine whether a request accepts JSON.

bool
acceptsMarkdown()

Determine whether a request accepts Markdown.

bool
acceptsHtml()

Determine whether a request accepts HTML.

static bool
matchesType(string $actual, string $type)

Determine if the given content types match.

string
format(string $default = 'html')

Get the data format expected in the response.

string|array|null
old(string|null $key = null, Model|string|array|null $default = null)

Retrieve an old input item.

void
flash()

Flash the input for the current request to the session.

void
flashOnly(mixed $keys)

Flash only some of the input to the session.

void
flashExcept(mixed $keys)

Flash only some of the input to the session.

void
flush()

Flush all of the old input from the session.

never
dd(mixed ...$args)

Dump the given arguments and terminate execution.

from  Dumpable
dump(mixed ...$args)

Dump the given arguments.

from  Dumpable
array
all(mixed $keys = null)

Retrieve all data from the instance.

mixed
data(string|null $key = null, mixed $default = null)

Retrieve data from the instance.

bool
exists(array|string $key)

Determine if the data contains a given key.

bool
has(array|string $key)

Determine if the data contains a given key.

bool
hasAny(array|string $keys)

Determine if the instance contains any of the given keys.

mixed
whenHas(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance contains the given key.

bool
filled(array|string $key)

Determine if the instance contains a non-empty value for the given key.

bool
isNotFilled(array|string $key)

Determine if the instance contains an empty value for the given key.

bool
anyFilled(array|string $keys)

Determine if the instance contains a non-empty value for any of the given keys.

mixed
whenFilled(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance contains a non-empty value for the given key.

mixed
whenEnum(string $key, string $enumClass, callable $callback, callable|null $default = null)

Apply the callback if the instance contains a valid enum value for the given key.

bool
missing(array|string $key)

Determine if the instance is missing a given key.

mixed
whenMissing(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance is missing the given key.

bool
isEmptyString(string $key)

Determine if the given key is an empty string for "filled".

str(string $key, mixed $default = null)

Retrieve data from the instance as a Stringable instance.

string(string $key, mixed $default = null)

Retrieve data from the instance as a Stringable instance.

bool
boolean(string|null $key = null, bool $default = false)

Retrieve data as a boolean value.

int
integer(string $key, int $default = 0)

Retrieve data as an integer value.

float
float(string $key, float $default = 0.0)

Retrieve data as a float value.

int|float
clamp(string $key, int|float $min, int|float $max, int|float $default = 0)

Retrieve data clamped between min and max values.

CarbonInterface|null
date(string $key, string|null $format = null, UnitEnum|string|null $tz = null)

Retrieve data from the instance as a Carbon instance.

CarbonInterval|null
interval(string $key, Unit|string|null $unit = null)

Retrieve data from the instance as a CarbonInterval instance.

mixed
enum(string $key, string $enumClass, mixed $default = null)

Retrieve data from the instance as an enum.

array
enums(string $key, string $enumClass)

Retrieve data from the instance as an array of enums.

bool
isBackedEnum(string $enumClass)

Determine if the given enum class is backed.

int|string|null
normalizeEnumValue(string $enumClass, mixed $value)

Normalize enum input to a strict backed value.

string|null
enumBackingType(string $enumClass)

Resolve and cache the enum backing type for repeated lookups.

array
array(array|string|null $key = null)

Retrieve data from the instance as an array.

collect(array|string|null $key = null)

Retrieve data from the instance as a collection.

array
only(mixed $keys)

Get a subset containing the provided keys with values from the instance data.

array
except(mixed $keys)

Get all of the data except for a specified array of items.

string|array|int|float|null
server(string|null $key = null, string|array|int|float|null $default = null)

Retrieve a server variable from the request.

bool
hasHeader(string $key)

Determine if a header is set on the request.

string|array|null
header(string|null $key = null, string|array|null $default = null)

Retrieve a header from the request.

string|null
bearerToken()

Get the bearer token from the request headers.

array
keys()

Get the keys for all of the input and files.

mixed
input(string|null $key = null, mixed $default = null)

Retrieve an input item from the request.

fluent(array|string|null $key = null, array $default = [])

Retrieve input from the request as a Fluent object instance.

string|array|null
query(string|null $key = null, string|array|null $default = null)

Retrieve a query string item from the request.

string|array|null
post(string|null $key = null, string|array|null $default = null)

Retrieve a request payload item from the request.

bool
hasCookie(string $key)

Determine if a cookie is set on the request.

string|array|null
cookie(string|null $key = null, string|array|null $default = null)

Retrieve a cookie from the request.

array
allFiles()

Get an array of all of the files on the request.

array
convertUploadedFiles(array $files)

Convert the given array of Symfony UploadedFiles to custom Hypervel UploadedFiles.

bool
hasFile(string $key)

Determine if the uploaded data contains a file.

bool
isValidFile(mixed $file)

Check that the given file is a valid file instance.

UploadedFile|array|null
file(string|null $key = null, mixed $default = null)

Retrieve a file from the request.

string|array|int|float|null
retrieveItem(string $source, string|null $key, string|array|int|float|null $default)

Retrieve a parameter item from a given source.

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

static void
macro(string $name, callable|object $macro)

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Check if macro is registered.

static void
flushMacros()

Flush the existing macros.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically handle calls to the class.

void
initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)

Initialize the request data.

from  Request
static Request
createFromGlobals()

Create a new HTTP request from PHP superglobals.

from  Request
static void
setTrustedProxies(array $proxies, int $trustedHeaderSet)

Set the trusted proxies on the current request.

from  Request
static array
getTrustedProxies()

Get the trusted proxies for the current request.

from  Request
static int
getTrustedHeaderSet()

Get the trusted-header bitmask for the current request.

from  Request
static void
setTrustedHosts(array $hostPatterns)

Set the trusted host patterns for the current request.

from  Request
static array
getTrustedHosts()

Get the trusted host patterns for the current request.

from  Request
instance()

Return the Request instance.

from  Request
string
method()

Get the request method.

from  Request
Uri
uri()

Get a URI instance for the request.

from  Request
string
root()

Get the root URL for the application.

from  Request
string
url()

Get the URL (no query string) for the request.

from  Request
string
fullUrl()

Get the full URL for the request.

from  Request
string
fullUrlWithQuery(array $query)

Get the full URL for the request with the added query string parameters.

from  Request
string
fullUrlWithoutQuery(array|string $keys)

Get the full URL for the request without the given query string parameters.

from  Request
string
path()

Get the current path info for the request.

from  Request
string
decodedPath()

Get the current decoded path info for the request.

from  Request
string|null
segment(int $index, string|null $default = null)

Get a segment from the URI (1 based index).

from  Request
array
segments()

Get all of the segments for the request path.

from  Request
bool
is(mixed ...$patterns)

Determine if the current request URI matches a pattern.

from  Request
bool
routeIs(mixed ...$patterns)

Determine if the route name matches a given pattern.

from  Request
bool
fullUrlIs(mixed ...$patterns)

Determine if the current request URL and query string match a pattern.

from  Request
string
host()

Get the host name.

from  Request
string
httpHost()

Get the HTTP host being requested.

from  Request
string
schemeAndHttpHost()

Get the scheme and HTTP host.

from  Request
bool
ajax()

Determine if the request is the result of an AJAX call.

from  Request
bool
pjax()

Determine if the request is the result of a PJAX call.

from  Request
bool
prefetch()

Determine if the request is the result of a prefetch call.

from  Request
bool
secure()

Determine if the request is over HTTPS.

from  Request
string|null
ip()

Get the client IP address.

from  Request
array
ips()

Get the client IP addresses.

from  Request
array
getClientIps()

Get the client IP addresses.

from  Request
string
getBaseUrl()

Return the root URL from which this request is executed.

from  Request
int|string|null
getPort()

Return the port on which the request is made.

from  Request
bool
isSecure()

Determine whether the request is secure.

from  Request
string
getHost()

Return the host name.

from  Request
bool
isFromTrustedProxy()

Determine whether this request originated from a trusted proxy.

from  Request
string|null
userAgent()

Get the client user agent.

from  Request
array
getAcceptableContentTypes()

No description

from  Request
merge(array $input)

Merge new input into the current request's input array.

from  Request
mergeIfMissing(array $input)

Merge new input into the request's input, but only when that key is missing from the request.

from  Request
replace(array $input)

Replace the input values for the current request.

from  Request
mixed
json(string|null $key = null, mixed $default = null)

Get the JSON payload for the request.

from  Request
InputBag
getInputSource()

Get the input source for the request.

from  Request
static Request
createFrom(Request $from, Request|null $to = null)

Create a new request instance from the given request.

from  Request
static Request
createFromBase(Request $request)

Create a Hypervel request from a Symfony instance.

from  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

from  Request
__clone()

Clone the current request.

from  Request
void
copyTrustedStateFrom(Request $from)

Copy trusted request configuration from another request.

from  Request
void
resetTrustedRequestCaches()

Reset the trusted-values cache and one-shot exception flags.

from  Request
string
getBaseUrlReal()

Return the real base URL without the trusted reverse proxy prefix.

from  Request
array
getTrustedValues(int $type, string|null $ip = null)

Parse the trusted forwarded-header values for the requested type.

from  Request
array
normalizeAndFilterClientIps(array $clientIps, string $ip)

Normalize and filter trusted client IPs.

from  Request
static bool
isHostValid(string $host)

Validate a host string per Symfony's URL-spec rules.

from  Request
mixed
filterFiles(mixed $files)

Filter the given array of files, removing any empty values.

from  Request
bool
hasSession(bool $skipIfUninitialized = false)

No description

from  Request
SessionInterface
getSession()

No description

from  Request
session()

Get the session associated with the request.

from  Request
void
setHypervelSession(Session $session)

Set the session instance on the request.

from  Request
void
setRequestLocale(string $locale)

Set the locale for the request instance.

from  Request
void
setDefaultRequestLocale(string $locale)

Set the default locale for the request instance.

from  Request
mixed
user(string|null $guard = null)

Get the user making the request.

from  Request
mixed
route(string|null $param = null, mixed $default = null)

Get the route handling the request.

from  Request
string
fingerprint()

Get a unique fingerprint for the request / route / IP address.

from  Request
setJson(InputBag $json)

Set the JSON payload for the request.

from  Request
getUserResolver()

Get the user resolver callback.

from  Request
setUserResolver(Closure $callback)

Set the user resolver callback.

from  Request
getRouteResolver()

Get the route resolver callback.

from  Request
setRouteResolver(Closure $callback)

Set the route resolver callback.

from  Request
array
toArray()

Get all of the input and files for the request.

from  Request
bool
offsetExists(mixed $offset)

Determine if the given offset exists.

from  Request
mixed
offsetGet(mixed $offset)

Get the value at the given offset.

from  Request
void
offsetSet(mixed $offset, mixed $value)

Set the value at the given offset.

from  Request
void
offsetUnset(mixed $offset)

Remove the value at the given offset.

from  Request
static void
flushState()

Flush all static state.

from  Request
bool
__isset(string $key)

Check if an input element is set on the request.

from  Request
mixed
__get(string $key)

Get an input element from the request.

from  Request
array
validate(array $rules, mixed ...$params)

No description

from  Request
array
validateWithBag(string $errorBag, array $rules, mixed ...$params)

No description

from  Request
bool
hasValidSignature(bool $absolute = 'true')

No description

from  Request
bool
hasValidRelativeSignature()

No description

from  Request
bool
hasValidSignatureWhileIgnoring(mixed $ignoreQuery = '[]', mixed $absolute = 'true')

No description

from  Request
bool
hasValidRelativeSignatureWhileIgnoring(mixed $ignoreQuery = '[]')

No description

from  Request
bool
inertia()

Registered as a macro by Hypervel\Inertia\InertiaServiceProvider.

from  Request
array
sparseFields(string $key)

Get the request's included fields.

array|null
sparseIncluded(string|null $key = null)

Get the request's included relationships.

Details

in CanBePrecognitive at line 14
array filterPrecognitiveRules(array $rules)

Filter the given array of rules into an array of rules that are included in precognitive headers.

Parameters

array $rules

Return Value

array

in CanBePrecognitive at line 30
protected bool shouldValidatePrecognitiveAttribute(string $attribute, array $validateOnly)

Determine if the given attribute should be validated.

Parameters

string $attribute
array $validateOnly

Return Value

bool

in CanBePrecognitive at line 46
bool isAttemptingPrecognition()

Determine if the request is attempting to be precognitive.

Return Value

bool

in CanBePrecognitive at line 54
bool isPrecognitive()

Determine if the request is precognitive.

Return Value

bool

bool isJson()

Determine if the request is sending JSON.

Return Value

bool

bool expectsJson()

Determine if the current request probably expects a JSON response.

Return Value

bool

bool wantsJson()

Determine if the current request is asking for JSON.

Return Value

bool

bool wantsMarkdown()

Determine if the current request is asking for Markdown.

Return Value

bool

bool accepts(string|array $contentTypes)

Determine whether the current requests accepts a given content type.

Parameters

string|array $contentTypes

Return Value

bool

string|null prefers(string|array $contentTypes)

Return the most suitable content type from the given array based on content negotiation.

Parameters

string|array $contentTypes

Return Value

string|null

bool acceptsAnyContentType()

Determine if the current request accepts any content type.

Return Value

bool

bool acceptsJson()

Determine whether a request accepts JSON.

Return Value

bool

bool acceptsMarkdown()

Determine whether a request accepts Markdown.

Return Value

bool

bool acceptsHtml()

Determine whether a request accepts HTML.

Return Value

bool

static bool matchesType(string $actual, string $type)

Determine if the given content types match.

Parameters

string $actual
string $type

Return Value

bool

string format(string $default = 'html')

Get the data format expected in the response.

Parameters

string $default

Return Value

string

string|array|null old(string|null $key = null, Model|string|array|null $default = null)

Retrieve an old input item.

Parameters

string|null $key
Model|string|array|null $default

Return Value

string|array|null

void flash()

Flash the input for the current request to the session.

Return Value

void

void flashOnly(mixed $keys)

Flash only some of the input to the session.

Parameters

mixed $keys

Return Value

void

void flashExcept(mixed $keys)

Flash only some of the input to the session.

Parameters

mixed $keys

Return Value

void

void flush()

Flush all of the old input from the session.

Return Value

void

in Dumpable at line 12
never dd(mixed ...$args)

Dump the given arguments and terminate execution.

Parameters

mixed ...$args

Return Value

never

in Dumpable at line 20
Dumpable dump(mixed ...$args)

Dump the given arguments.

Parameters

mixed ...$args

Return Value

Dumpable

in InteractsWithData at line 30
abstract array all(mixed $keys = null)

Retrieve all data from the instance.

Parameters

mixed $keys

Return Value

array

in InteractsWithData at line 35
abstract protected mixed data(string|null $key = null, mixed $default = null)

Retrieve data from the instance.

Parameters

string|null $key
mixed $default

Return Value

mixed

in InteractsWithData at line 40
bool exists(array|string $key)

Determine if the data contains a given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 48
bool has(array|string $key)

Determine if the data contains a given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 66
bool hasAny(array|string $keys)

Determine if the instance contains any of the given keys.

Parameters

array|string $keys

Return Value

bool

in InteractsWithData at line 80
mixed whenHas(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance contains the given key.

Parameters

string $key
callable $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 96
bool filled(array|string $key)

Determine if the instance contains a non-empty value for the given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 112
bool isNotFilled(array|string $key)

Determine if the instance contains an empty value for the given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 128
bool anyFilled(array|string $keys)

Determine if the instance contains a non-empty value for any of the given keys.

Parameters

array|string $keys

Return Value

bool

in InteractsWithData at line 146
mixed whenFilled(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance contains a non-empty value for the given key.

Parameters

string $key
callable $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 168
mixed whenEnum(string $key, string $enumClass, callable $callback, callable|null $default = null)

Apply the callback if the instance contains a valid enum value for the given key.

Parameters

string $key
string $enumClass
callable $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 188
bool missing(array|string $key)

Determine if the instance is missing a given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 198
mixed whenMissing(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance is missing the given key.

Parameters

string $key
callable $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 214
protected bool isEmptyString(string $key)

Determine if the given key is an empty string for "filled".

Parameters

string $key

Return Value

bool

in InteractsWithData at line 224
Stringable str(string $key, mixed $default = null)

Retrieve data from the instance as a Stringable instance.

Parameters

string $key
mixed $default

Return Value

Stringable

in InteractsWithData at line 232
Stringable string(string $key, mixed $default = null)

Retrieve data from the instance as a Stringable instance.

Parameters

string $key
mixed $default

Return Value

Stringable

in InteractsWithData at line 242
bool boolean(string|null $key = null, bool $default = false)

Retrieve data as a boolean value.

Returns true when value is "1", "true", "on", and "yes". Otherwise, returns false.

Parameters

string|null $key
bool $default

Return Value

bool

in InteractsWithData at line 250
int integer(string $key, int $default = 0)

Retrieve data as an integer value.

Parameters

string $key
int $default

Return Value

int

in InteractsWithData at line 258
float float(string $key, float $default = 0.0)

Retrieve data as a float value.

Parameters

string $key
float $default

Return Value

float

in InteractsWithData at line 266
int|float clamp(string $key, int|float $min, int|float $max, int|float $default = 0)

Retrieve data clamped between min and max values.

Parameters

string $key
int|float $min
int|float $max
int|float $default

Return Value

int|float

in InteractsWithData at line 283
CarbonInterface|null date(string $key, string|null $format = null, UnitEnum|string|null $tz = null)

Retrieve data from the instance as a Carbon instance.

Parameters

string $key
string|null $format
UnitEnum|string|null $tz

Return Value

CarbonInterface|null

Exceptions

InvalidFormatException

in InteractsWithData at line 301
CarbonInterval|null interval(string $key, Unit|string|null $unit = null)

Retrieve data from the instance as a CarbonInterval instance.

Parameters

string $key
Unit|string|null $unit

Return Value

CarbonInterval|null

in InteractsWithData at line 327
mixed enum(string $key, string $enumClass, mixed $default = null)

Retrieve data from the instance as an enum.

Parameters

string $key
string $enumClass
mixed $default

Return Value

mixed

in InteractsWithData at line 350
array enums(string $key, string $enumClass)

Retrieve data from the instance as an array of enums.

Parameters

string $key
string $enumClass

Return Value

array

in InteractsWithData at line 369
protected bool isBackedEnum(string $enumClass)

Determine if the given enum class is backed.

Parameters

string $enumClass

Return Value

bool

in InteractsWithData at line 377
protected int|string|null normalizeEnumValue(string $enumClass, mixed $value)

Normalize enum input to a strict backed value.

Parameters

string $enumClass
mixed $value

Return Value

int|string|null

in InteractsWithData at line 422
protected string|null enumBackingType(string $enumClass)

Resolve and cache the enum backing type for repeated lookups.

Parameters

string $enumClass

Return Value

string|null

in InteractsWithData at line 433
array array(array|string|null $key = null)

Retrieve data from the instance as an array.

Parameters

array|string|null $key

Return Value

array

in InteractsWithData at line 441
Collection collect(array|string|null $key = null)

Retrieve data from the instance as a collection.

Parameters

array|string|null $key

Return Value

Collection

in InteractsWithData at line 451
array only(mixed $keys)

Get a subset containing the provided keys with values from the instance data.

Parameters

mixed $keys

Return Value

array

in InteractsWithData at line 475
array except(mixed $keys)

Get all of the data except for a specified array of items.

Parameters

mixed $keys

Return Value

array

in InteractsWithInput at line 23
string|array|int|float|null server(string|null $key = null, string|array|int|float|null $default = null)

Retrieve a server variable from the request.

Parameters

string|null $key
string|array|int|float|null $default

Return Value

string|array|int|float|null

in InteractsWithInput at line 31
bool hasHeader(string $key)

Determine if a header is set on the request.

Parameters

string $key

Return Value

bool

in InteractsWithInput at line 39
string|array|null header(string|null $key = null, string|array|null $default = null)

Retrieve a header from the request.

Parameters

string|null $key
string|array|null $default

Return Value

string|array|null

in InteractsWithInput at line 47
string|null bearerToken()

Get the bearer token from the request headers.

Return Value

string|null

in InteractsWithInput at line 65
array keys()

Get the keys for all of the input and files.

Return Value

array

in InteractsWithInput at line 93
mixed input(string|null $key = null, mixed $default = null)

Retrieve an input item from the request.

Parameters

string|null $key
mixed $default

Return Value

mixed

in InteractsWithInput at line 105
Fluent fluent(array|string|null $key = null, array $default = [])

Retrieve input from the request as a Fluent object instance.

Parameters

array|string|null $key
array $default

Return Value

Fluent

in InteractsWithInput at line 115
string|array|null query(string|null $key = null, string|array|null $default = null)

Retrieve a query string item from the request.

Parameters

string|null $key
string|array|null $default

Return Value

string|array|null

in InteractsWithInput at line 123
string|array|null post(string|null $key = null, string|array|null $default = null)

Retrieve a request payload item from the request.

Parameters

string|null $key
string|array|null $default

Return Value

string|array|null

in InteractsWithInput at line 131
bool hasCookie(string $key)

Determine if a cookie is set on the request.

Parameters

string $key

Return Value

bool

Retrieve a cookie from the request.

Parameters

string|null $key
string|array|null $default

Return Value

string|array|null

in InteractsWithInput at line 149
array allFiles()

Get an array of all of the files on the request.

Return Value

array

in InteractsWithInput at line 162
protected array convertUploadedFiles(array $files)

Convert the given array of Symfony UploadedFiles to custom Hypervel UploadedFiles.

Parameters

array $files

Return Value

array

in InteractsWithInput at line 178
bool hasFile(string $key)

Determine if the uploaded data contains a file.

Parameters

string $key

Return Value

bool

in InteractsWithInput at line 196
protected bool isValidFile(mixed $file)

Check that the given file is a valid file instance.

Parameters

mixed $file

Return Value

bool

in InteractsWithInput at line 206
UploadedFile|array|null file(string|null $key = null, mixed $default = null)

Retrieve a file from the request.

Parameters

string|null $key
mixed $default

Return Value

UploadedFile|array|null

in InteractsWithInput at line 222
protected string|array|int|float|null retrieveItem(string $source, string|null $key, string|array|int|float|null $default)

Retrieve a parameter item from a given source.

Parameters

string $source
string|null $key
string|array|int|float|null $default

Return Value

string|array|int|float|null

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Macroable at line 28
static void macro(string $name, callable|object $macro)

Register a custom macro.

Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.

Parameters

string $name
callable|object $macro

Return Value

void

in Macroable at line 41
static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 57
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line 68
static void flushMacros()

Flush the existing macros.

Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.

Return Value

void

in Macroable at line 78
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line 103
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Request at line 145
void initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)

Initialize the request data.

Parameters

array $query
array $request
array $attributes
array $cookies
array $files
array $server
$content

Return Value

void

in Request at line 162
static Request createFromGlobals()

Create a new HTTP request from PHP superglobals.

Return Value

Request

Exceptions

RuntimeException

in Request at line 170
static void setTrustedProxies(array $proxies, int $trustedHeaderSet)

Set the trusted proxies on the current request.

Parameters

array $proxies
int $trustedHeaderSet

Return Value

void

in Request at line 205
static array getTrustedProxies()

Get the trusted proxies for the current request.

Return Value

array

in Request at line 215
static int getTrustedHeaderSet()

Get the trusted-header bitmask for the current request.

Return Value

int

in Request at line 225
static void setTrustedHosts(array $hostPatterns)

Set the trusted host patterns for the current request.

Parameters

array $hostPatterns

Return Value

void

in Request at line 246
static array getTrustedHosts()

Get the trusted host patterns for the current request.

Return Value

array

in Request at line 258
Request instance()

Return the Request instance.

Return Value

Request

in Request at line 266
string method()

Get the request method.

Return Value

string

in Request at line 274
Uri uri()

Get a URI instance for the request.

Return Value

Uri

in Request at line 282
string root()

Get the root URL for the application.

Return Value

string

in Request at line 290
string url()

Get the URL (no query string) for the request.

Return Value

string

in Request at line 298
string fullUrl()

Get the full URL for the request.

Return Value

string

in Request at line 310
string fullUrlWithQuery(array $query)

Get the full URL for the request with the added query string parameters.

Parameters

array $query

Return Value

string

in Request at line 322
string fullUrlWithoutQuery(array|string $keys)

Get the full URL for the request without the given query string parameters.

Parameters

array|string $keys

Return Value

string

in Request at line 336
string path()

Get the current path info for the request.

Return Value

string

in Request at line 346
string decodedPath()

Get the current decoded path info for the request.

Return Value

string

in Request at line 354
string|null segment(int $index, string|null $default = null)

Get a segment from the URI (1 based index).

Parameters

int $index
string|null $default

Return Value

string|null

in Request at line 362
array segments()

Get all of the segments for the request path.

Return Value

array

in Request at line 374
bool is(mixed ...$patterns)

Determine if the current request URI matches a pattern.

Parameters

mixed ...$patterns

Return Value

bool

in Request at line 383
bool routeIs(mixed ...$patterns)

Determine if the route name matches a given pattern.

Parameters

mixed ...$patterns

Return Value

bool

in Request at line 391
bool fullUrlIs(mixed ...$patterns)

Determine if the current request URL and query string match a pattern.

Parameters

mixed ...$patterns

Return Value

bool

in Request at line 400
string host()

Get the host name.

Return Value

string

in Request at line 408
string httpHost()

Get the HTTP host being requested.

Return Value

string

in Request at line 416
string schemeAndHttpHost()

Get the scheme and HTTP host.

Return Value

string

in Request at line 424
bool ajax()

Determine if the request is the result of an AJAX call.

Return Value

bool

in Request at line 432
bool pjax()

Determine if the request is the result of a PJAX call.

Return Value

bool

in Request at line 440
bool prefetch()

Determine if the request is the result of a prefetch call.

Return Value

bool

in Request at line 450
bool secure()

Determine if the request is over HTTPS.

Return Value

bool

in Request at line 458
string|null ip()

Get the client IP address.

Return Value

string|null

in Request at line 466
array ips()

Get the client IP addresses.

Return Value

array

in Request at line 474
array getClientIps()

Get the client IP addresses.

Return Value

array

in Request at line 489
string getBaseUrl()

Return the root URL from which this request is executed.

Return Value

string

in Request at line 505
int|string|null getPort()

Return the port on which the request is made.

Return Value

int|string|null

in Request at line 532
bool isSecure()

Determine whether the request is secure.

Return Value

bool

in Request at line 548
string getHost()

Return the host name.

Return Value

string

in Request at line 595
bool isFromTrustedProxy()

Determine whether this request originated from a trusted proxy.

Return Value

bool

in Request at line 605
string|null userAgent()

Get the client user agent.

Return Value

string|null

in Request at line 610
array getAcceptableContentTypes()

No description

Return Value

array

in Request at line 629
Request merge(array $input)

Merge new input into the current request's input array.

Parameters

array $input

Return Value

Request

in Request at line 645
Request mergeIfMissing(array $input)

Merge new input into the request's input, but only when that key is missing from the request.

Parameters

array $input

Return Value

Request

in Request at line 659
Request replace(array $input)

Replace the input values for the current request.

Parameters

array $input

Return Value

Request

in Request at line 674
mixed json(string|null $key = null, mixed $default = null)

Get the JSON payload for the request.

Parameters

string|null $key
mixed $default

Return Value

mixed

in Request at line 690
protected InputBag getInputSource()

Get the input source for the request.

Return Value

InputBag

in Request at line 702
static Request createFrom(Request $from, Request|null $to = null)

Create a new request instance from the given request.

Parameters

Request $from
Request|null $to

Return Value

Request

in Request at line 743
static Request createFromBase(Request $request)

Create a Hypervel request from a Symfony instance.

Parameters

Request $request

Return Value

Request

in Request at line 769
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

Parameters

array|null $query
array|null $request
array|null $attributes
array|null $cookies
array|null $files
array|null $server

Return Value

Request

in Request at line 778
__clone()

Clone the current request.

in Request at line 791
protected void copyTrustedStateFrom(Request $from)

Copy trusted request configuration from another request.

Parameters

Request $from

Return Value

void

in Request at line 806
protected void resetTrustedRequestCaches()

Reset the trusted-values cache and one-shot exception flags.

Return Value

void

in Request at line 816
protected string getBaseUrlReal()

Return the real base URL without the trusted reverse proxy prefix.

Return Value

string

in Request at line 826
protected array getTrustedValues(int $type, string|null $ip = null)

Parse the trusted forwarded-header values for the requested type.

Parameters

int $type
string|null $ip

Return Value

array

in Request at line 903
protected array normalizeAndFilterClientIps(array $clientIps, string $ip)

Normalize and filter trusted client IPs.

Parameters

array $clientIps
string $ip

Return Value

array

in Request at line 941
static protected bool isHostValid(string $host)

Validate a host string per Symfony's URL-spec rules.

Parameters

string $host

Return Value

bool

in Request at line 958
protected mixed filterFiles(mixed $files)

Filter the given array of files, removing any empty values.

Parameters

mixed $files

Return Value

mixed

in Request at line 980
bool hasSession(bool $skipIfUninitialized = false)

No description

Parameters

bool $skipIfUninitialized

Return Value

bool

in Request at line 986
SessionInterface getSession()

No description

Return Value

SessionInterface

in Request at line 1001
Session session()

Get the session associated with the request.

Return Value

Session

Exceptions

RuntimeException

in Request at line 1015
void setHypervelSession(Session $session)

Set the session instance on the request.

Parameters

Session $session

Return Value

void

in Request at line 1023
void setRequestLocale(string $locale)

Set the locale for the request instance.

Parameters

string $locale

Return Value

void

in Request at line 1031
void setDefaultRequestLocale(string $locale)

Set the default locale for the request instance.

Parameters

string $locale

Return Value

void

in Request at line 1039
mixed user(string|null $guard = null)

Get the user making the request.

Parameters

string|null $guard

Return Value

mixed

in Request at line 1049
mixed route(string|null $param = null, mixed $default = null)

Get the route handling the request.

Parameters

string|null $param
mixed $default

Return Value

mixed

in Request at line 1072
string fingerprint()

Get a unique fingerprint for the request / route / IP address.

Return Value

string

Exceptions

RuntimeException

in Request at line 1089
Request setJson(InputBag $json)

Set the JSON payload for the request.

Parameters

InputBag $json

Return Value

Request

in Request at line 1099
Closure getUserResolver()

Get the user resolver callback.

Return Value

Closure

in Request at line 1110
Request setUserResolver(Closure $callback)

Set the user resolver callback.

Parameters

Closure $callback

Return Value

Request

in Request at line 1120
Closure getRouteResolver()

Get the route resolver callback.

Return Value

Closure

in Request at line 1131
Request setRouteResolver(Closure $callback)

Set the route resolver callback.

Parameters

Closure $callback

Return Value

Request

in Request at line 1141
array toArray()

Get all of the input and files for the request.

Return Value

array

in Request at line 1149
bool offsetExists(mixed $offset)

Determine if the given offset exists.

Parameters

mixed $offset

Return Value

bool

in Request at line 1162
mixed offsetGet(mixed $offset)

Get the value at the given offset.

Parameters

mixed $offset

Return Value

mixed

in Request at line 1170
void offsetSet(mixed $offset, mixed $value)

Set the value at the given offset.

Parameters

mixed $offset
mixed $value

Return Value

void

in Request at line 1178
void offsetUnset(mixed $offset)

Remove the value at the given offset.

Parameters

mixed $offset

Return Value

void

in Request at line 1186
static void flushState()

Flush all static state.

Return Value

void

in Request at line 1200
bool __isset(string $key)

Check if an input element is set on the request.

Parameters

string $key

Return Value

bool

in Request at line 1208
mixed __get(string $key)

Get an input element from the request.

Parameters

string $key

Return Value

mixed

in Request at line 38
array validate(array $rules, mixed ...$params)

No description

Parameters

array $rules
mixed ...$params

Return Value

array

in Request at line 38
array validateWithBag(string $errorBag, array $rules, mixed ...$params)

No description

Parameters

string $errorBag
array $rules
mixed ...$params

Return Value

array

in Request at line 38
bool hasValidSignature(bool $absolute = 'true')

No description

Parameters

bool $absolute

Return Value

bool

in Request at line 38
bool hasValidRelativeSignature()

No description

Return Value

bool

in Request at line 38
bool hasValidSignatureWhileIgnoring(mixed $ignoreQuery = '[]', mixed $absolute = 'true')

No description

Parameters

mixed $ignoreQuery
mixed $absolute

Return Value

bool

in Request at line 38
bool hasValidRelativeSignatureWhileIgnoring(mixed $ignoreQuery = '[]')

No description

Parameters

mixed $ignoreQuery

Return Value

bool

in Request at line 38
bool inertia()

Registered as a macro by Hypervel\Inertia\InertiaServiceProvider.

Return Value

bool

at line 26
array sparseFields(string $key)

Get the request's included fields.

Parameters

string $key

Return Value

array

at line 40
array|null sparseIncluded(string|null $key = null)

Get the request's included relationships.

Parameters

string|null $key

Return Value

array|null