Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

emajic's avatar

Route is not working with required param and query string.

Hoping to get some help on a lumen/laravel problem, I am stumped.

I have routes like so:

$app->get('images','ImageController@index');
$app->get('images/{id}','ImageController@getImage');

I want to add optional parameters to my second route.

so

www.site.com/images/1?size=1&bucket_id=1

Problem is that the required {id} that is sent to the controller is both the required param and the query string merged.

e.g

$id=1size=1&bucket_id=1

It needs to be a get. Tips appreciated.

0 likes
2 replies
emajic's avatar

@jlrdw Hoping to avoid keep images/1 format. Is the only alternative to merge both routes into images and just put the /1/ in the query string ? so www.site.com/images?id=1&size=1&bucket_id=1

Please or to participate in this conversation.