title: How to build optional parameters as question marks in Slim?
body: <p>I've built my first RESTful API ever and used Slim as my framework. It works well so far.</p>
  
  <p>Now I have seen a great API Design Guide which explained, the best way to build an API is to keep the levels flat. I want to do that and try to figure out how to build an URI like this:</p>
  
  <pre><code>my-domain.int/groups/search?q=my_query
  </code></pre>
  
  <p>The /groups part already works with GET, POST, PUT, DELETE and also the search query works like this: </p>
  
  <pre><code>my-domain.int/groups/search/my_query
  </code></pre>
  
  <p>This is the code I use for the routing in PHP:</p>
  
  <pre><code>$app-&gt;get('/groups/search/:query', 'findByName');
  </code></pre>
  
  <p>I just can't figure out how to build optional parameters with an question mark in Slim. I wasn't able to find anything on Google.</p>
  
  <p>EDIT: 
  Since the search not seems to be suitable for my scenario I try to show another way of what I want to realize:</p>
  
  <p>Let's say I want to get a partial response from the API. The request should look like that:</p>
  
  <pre><code>my-domain.int/groups?fields=name,description
  </code></pre>
  
  <p>Not like that:</p>
  
  <pre><code>my-domain.int/groups/fields/name/description
  </code></pre>
  
  <p>How do I realize that in the routing?</p>