function Request::get
Gets a "parameter" value from any bag.
This method is mainly useful for libraries that want to provide some flexibility. If you don't need the flexibility in controllers, it is better to explicitly get request parameters from the appropriate public property instead (attributes, query, request).
Order of precedence: PATH (routing placeholders or custom attributes), GET, POST
@internal use explicit input sources instead
1 call to Request::get()
- Request::duplicate in vendor/
symfony/ http-foundation/ Request.php - Clones a request and overrides some of its parameters.
File
-
vendor/
symfony/ http-foundation/ Request.php, line 656
Class
- Request
- Request represents an HTTP request.
Namespace
Symfony\Component\HttpFoundationCode
public function get(string $key, mixed $default = null) : mixed {
if ($this !== ($result = $this->attributes
->get($key, $this))) {
return $result;
}
if ($this->query
->has($key)) {
return $this->query
->all()[$key];
}
if ($this->request
->has($key)) {
return $this->request
->all()[$key];
}
return $default;
}