How to GET all parameters from link

Hi everyone,
check this:

$this → get(‘/category/{id}/{name}[/{params}]’, function($request, $response, $args) {
$Offers = new Offers($this → db);

  var_dump($_GET);
}) -> setName('catalog-category');

and if i go to page like this: Login | HSTS Redirection Community

i want to get from $_GET superglobal filter2 value, minPrice value, maxPrice value, all $_GET array, but this doesnt work.
whats the problem?

Hi!

Have you tried this?

var_dump($args['params']);

@odan sorry, my mistake. My routing looks like this: $this -> get(’/category/{id}/{name} without params. And if i write $args[‘name’] the results is name from routing and data which i want from $_GET variable, but i want all $_GET parameters in array :confused:

In this case you must format the url query string correctly.

A query string starts with a ?, the following parameters are separated by &.

Here is a correct URL (example):
http://www.example.com/catalog/category/2/T-shirty-i-koszulki?filter2=1&minPrice=1&maxPrice=0&offerType=01

Slim 3 is based on PSR-7 (HTTP Message). Therefore you have to get all request parameters from the $request object.

You can get the query parameters as an associative array on the Request object using $request->getQueryParams().

You can also get a single query parameter value, with optional default value if the parameter is missing, using $request->getQueryParam($key, $default = null).

Example:
$filter2 = $request->getQueryParam('filter2');
var_dump($filter2);

The prerequisite is, however, that the URL (as described above) is correctly formatted.