Request
class Request implements ArrayAccess
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected array | $data | The decoded payload for the request. |
|
| protected bool | $hasDecodedData | Determine whether the request data has been decoded. |
|
| protected array | $attributes | The attribute data passed when building the PendingRequest. |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new request instance.
Get the request method.
Get the URL of the request.
Determine if the request has a given header.
Determine if the request has the given headers.
Get the values for the header with the given name.
Get the request headers.
Get the body of the request.
Determine if the request contains the given file.
Get the request's data (form parameters or JSON).
Get the request's form parameters.
Get the decoded JSON body of the request.
Determine if the request is simple form data.
Determine if the request is JSON.
Determine if the request is multipart.
Get the normalized request media type.
Get the request query parameters.
Remove query parameters from the request.
Get the attribute data from the request.
Set the request's attribute data.
Get the underlying PSR compliant request instance.
Determine if the given offset exists.
Get the value for a given offset.
Set the value at the given offset.
Unset the value at the given offset.
Flush all static state.
Details
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.
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.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
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.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 39
__construct(RequestInterface $request)
Create a new request instance.
at line 46
string
method()
Get the request method.
at line 54
string
url()
Get the URL of the request.
at line 62
Uri
uri()
Get the request URI as a URI instance.
at line 70
bool
hasHeader(string $key, mixed $value = null)
Determine if the request has a given header.
at line 88
bool
hasHeaders(array|string $headers)
Determine if the request has the given headers.
at line 100
array
header(string $key)
Get the values for the header with the given name.
at line 108
array
headers()
Get the request headers.
at line 116
string
body()
Get the body of the request.
at line 124
bool
hasFile(string $name, string|null $value = null, string|null $filename = null)
Determine if the request contains the given file.
at line 143
array
data()
Get the request's data (form parameters or JSON).
at line 158
protected array
parameters()
Get the request's form parameters.
at line 176
protected array
json()
Get the decoded JSON body of the request.
at line 203
bool
isForm()
Determine if the request is simple form data.
at line 211
bool
isJson()
Determine if the request is JSON.
at line 219
bool
isMultipart()
Determine if the request is multipart.
at line 227
protected string
mediaType()
Get the normalized request media type.
at line 241
Request
withData(array $data)
Set the logical data on the request.
This does not mark the body as decoded, so a final JSON or form body may replace it.
at line 251
array
query()
Get the request query parameters.
at line 261
Request
withQuery(array $query = [])
Add query parameters to the request.
at line 273
Request
withoutQuery(array|string $keys = [])
Remove query parameters from the request.
at line 287
array
attributes()
Get the attribute data from the request.
at line 295
Request
setRequestAttributes(array $attributes)
Set the request's attribute data.
at line 305
RequestInterface
toPsrRequest()
Get the underlying PSR compliant request instance.
at line 315
bool
offsetExists(string $offset)
Determine if the given offset exists.
at line 325
mixed
offsetGet(string $offset)
Get the value for a given offset.
at line 337
void
offsetSet(string $offset, mixed $value)
Set the value at the given offset.
at line 349
void
offsetUnset(string $offset)
Unset the value at the given offset.
at line 357
static void
flushState()
Flush all static state.