The Request object presents these readonly properties as copies of the PHP superglobals:
array $cookies: A copy of
array $files: A copy of
array $input: A copy of
$_POST, or a
json_decode()d array from the
content body (see below).
array $query: A copy of
array $server: A copy of
You can work with them the same as you would with any readonly array:
// get the `?q=` value, defaulting to an empty string $searchTerm = $request->query['q'] ?? '';
$_POST superglobal is populated by PHP when it can decode the content
However, it is often the case that content bodies are JSON encoded instead.
Thus, as a convenience, if the Request
$request->input will be an array computed by applying
the content body.
You can provide alternative or custom values via the
$request = new Request( globals: [ '_COOKIE' => [...], '_FILES' => [...], '_GET' => [...], '_POST' => [...], '_SERVER' => [...], ] );
Any values not present in the
$globals constructor parameter will be provided
by the existing superglobal.