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

mehany's avatar
Level 13

What is a good way to handle URL parameters uppercase / lowercase?

I have an API that accepts several parameters and I want to ignore the letters case whether Uppercase or lowercase! how can I achieve this without missing up my code.

0 likes
5 replies
jlrdw's avatar

Normally the URL ignores case anyway. I'don't use lowercase in code that seems to be fairly standard

1 like
jrdavidson's avatar

I would assume adding a regex to your route so that it accepts both upper and lowercase.

masterpowers's avatar

This will enforce a slug in your routes file

Route::get('articles/{slug}', 'ArticleController@getFull')->where('slug', '[a-z0-9-]+');

let me know if fix your problem or answer your question or need more explanation or example :)

Please or to participate in this conversation.