Skip to content

ServerRequest: withQueryParams Example

Terry L edited this page Jun 18, 2020 · 3 revisions

Extends Request.

withQueryParams($query)

  • param array query * Array of query string arguments, typically from $_GET.
  • return static

Example:

$serverRequests = $serverRequests->withQueryParams([
    'foo' => 'baz',
    'yes' => 'I do',
]);

$queryParams = $serverRequests->getQueryParams();

print(print_r($queryParams, true));

/* Outputs:

    Array
    (
        [foo] => baz
        [yes] => I do
    )

*/
Clone this wiki locally