Category: Laravel

It’s a well-known feature, but still in some cases it may require longer research to find the good regex patterns for defining constraints for our route parameters.
Getting StartedFirst of all, let’s see how to even use patterns to create rules for our routes.
In your routes file – web.php or api.php – where you define your routes, you can add other options as well, like the patterns you wish to use.
Without regular expressions, we would have to define the routes individually and put them before the dynamic route.
SummaryWe can see, that we have an almost infinite way to make rules that we want to apply to our routes.

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Community Partners