There are 2 ways to add query parameters using the URL view helper in Zend Framework 2, either using Segment route placeholders, or adding them as normal query parameters (e.g. url?id=1&name=barney)

Which one you need to use depends on what route the view helper is being used on; since all URL’s in Zend Framework 2 need to be route-aware (even if you’re mimicking ZF1 routing) it depends whether the route you’ve specific is ‘aware’ of the parameters.

Segment route parameters

If you have setup a route with segment placeholder for the parameters you need to use, you will be able to specify them

Normal query parameters