# How to GET all parameters from link

**URL:** <https://discourse.slimframework.com/t/how-to-get-all-parameters-from-link/2003>\
**Category:** Questions\
**Created:** [November 12, 2017, 7:13pm UTC](https://discourse.slimframework.com/t/how-to-get-all-parameters-from-link/2003 "2017-11-12T19:13:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![furyxpl](https://avatars.discourse-cdn.com/v4/letter/f/f6c823/32.png) [@furyxpl](https://discourse.slimframework.com/u/furyxpl)\
**Post date:** [November 12, 2017, 7:13pm UTC](https://discourse.slimframework.com/t/how-to-get-all-parameters-from-link/2003/1 "2017-11-12T19:13:22Z")

</div>

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](http://site.com/catalog/category/2/T-shirty-i-koszulki&filter2=1&minPrice=1&maxPrice=0&offerType=0)

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

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [November 12, 2017, 7:42pm UTC](https://discourse.slimframework.com/t/how-to-get-all-parameters-from-link/2003/2 "2017-11-12T19:42:49Z")

</div>

Hi!

Have you tried this?

```
var_dump($args['params']);
```

---

<div class="post-metadata">

**Author:** ![furyxpl](https://avatars.discourse-cdn.com/v4/letter/f/f6c823/32.png) [@furyxpl](https://discourse.slimframework.com/u/furyxpl)\
**Post date:** [November 12, 2017, 8:05pm UTC](https://discourse.slimframework.com/t/how-to-get-all-parameters-from-link/2003/3 "2017-11-12T20:05:59Z")

</div>

@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 😕

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [November 12, 2017, 8:23pm UTC](https://discourse.slimframework.com/t/how-to-get-all-parameters-from-link/2003/4 "2017-11-12T20:23:54Z")

</div>

In this case you must format the url [query string](https://en.wikipedia.org/wiki/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](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.
