Request
class Request implements ArrayAccess (View source)
Properties
protected RequestInterface | $request | The underlying PSR request. | |
protected array | $data | The decoded payload for the request. |
Methods
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
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/8.x/Illuminate/Http/Client/Request.html