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

latz's avatar
Level 3

Regular Expression Constraints - Routing Lumen

I don't understand the following:

$router->get('team/{id:[A-Za-z]+}', ['uses' => 'TeamController@show']);

When I call the URL /team/123 I get a 405 response as answer. If I change the route to:

$router->get('team/{id:[0-9]+}', ['uses' => 'TeamController@show']);

and call /team/abc i get a 404 Error. I would also like to have a 405 response for letters.

What am I doing wrong?

0 likes
0 replies

Please or to participate in this conversation.