Reference

Guide

$request

The Request class provides a simple API to inspect incoming requests.

How to get a $request object

The $request object is available via the $kirby object:

$request = $kirby->request();

Examples

With the object in place, you have access to all the methods listed above.

Detect if the request is an Ajax request

if ($request->ajax()) {
  // do something
}

Get a specific variable from the query string

$filter = $request->query()->filter();

Get the Params object

The $params object contains all URL parameters

$params = $request->params();

Get the request method

$method = $request->method();