Note: as the ‘?’ indicates in the title, I’m not sure if this is the “best” way or even a “good” way. But it’s definitely a different way than Laravel’s regular expression route constraints.
I realized recently that I wasn’t doing a good job of validating the route parameters in my Laravel application in my RESTful URIs, so I started working on a solution.
File this under “mostly for my own benefit”, since I often forget how I accomplished something when I need to go back and do it again.
As of March 15, 2013, PHP 5.3.x will only receive “critical fixes” and people are encouraged to upgrade to 5.4 or 5.5. And sometime in 2014, 5.3.x will not longer be supported at all. All of the Linux servers I’m working on now are running Ubuntu 12.04 LTS, which currently provides PHP 5.3.10, so I decided to look into what it takes to update to 5.4.x on these boxes.