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

dengdeng's avatar

Laravel route parameters order

I have a problem in basic laravel route parameters order. For example.

Route::get('user/{id}/{name}'),function($id,$name){
    return "Your id is $id and name is $name";
});

and

Route::get('user/{id}/{name}'),function($name,$id){
    return "Your id is $id and name is $name";
});

The first one is right.The second one the content are opposite.So i don't have to make their names are same, right?

0 likes
1 reply
d3xt3r's avatar
d3xt3r
Best Answer
Level 29

Yes, that is true for such kinds, i.e. name doesn't matter. However, for implicit route model binding variable name should match the route parameter.

1 like

Please or to participate in this conversation.