On this page
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
static void | macro(string $name, object|callable $macro) Register a custom macro. |
from Macroable |
static void | mixin(object $mixin, bool $replace = true) Mix another object into the class. |
from Macroable |
static bool | hasMacro(string $name) Checks if macro is registered. |
from Macroable |
static void | flushMacros() Flush the existing macros. |
from Macroable |
static mixed | __callStatic(string $method, array $parameters) Dynamically handle calls to the class. |
from Macroable |
mixed | __call(string $method, array $parameters) Dynamically handle calls to the class. |
from Macroable |
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). |
|
array | parameters() Get the request's form parameters. |
|
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. |
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.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Http/Client/Request.html