Request
class Request implements ArrayAccess (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
protected RequestInterface | $request | The underlying PSR request. |
|
protected array | $data | The decoded payload for the request. |
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 JSON decoded body of the request.
Determine if the request is simple form data.
Determine if the request is JSON.
Determine if the request is multipart.
Set the decoded data on the request.
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.
Details
static void
macro(string $name, object|callable $macro)
Register a custom macro.
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
static bool
hasMacro(string $name)
Checks 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
__construct(RequestInterface $request)
Create a new request instance.
string
method()
Get the request method.
string
url()
Get the URL of the request.
bool
hasHeader(string $key, mixed $value = null)
Determine if the request has a given header.
bool
hasHeaders(array|string $headers)
Determine if the request has the given headers.
array
header(string $key)
Get the values for the header with the given name.
array
headers()
Get the request headers.
string
body()
Get the body of the request.
bool
hasFile(string $name, string|null $value = null, string|null $filename = null)
Determine if the request contains the given file.
array
data()
Get the request's data (form parameters or JSON).
protected array
parameters()
Get the request's form parameters.
protected array
json()
Get the JSON decoded body of the request.
bool
isForm()
Determine if the request is simple form data.
bool
isJson()
Determine if the request is JSON.
bool
isMultipart()
Determine if the request is multipart.
$this
withData(array $data)
Set the decoded data on the request.
RequestInterface
toPsrRequest()
Get the underlying PSR compliant request instance.
bool
offsetExists(string $offset)
Determine if the given offset exists.
mixed
offsetGet(string $offset)
Get the value for a given offset.
void
offsetSet(string $offset, mixed $value)
Set the value at the given offset.
void
offsetUnset(string $offset)
Unset the value at the given offset.