codeguy/Slim — pull request #613 by amcsi (2013-09-11 15:01:46+00:00)
Title: Support for query parameters in routing

I would like to contribute this bit of code which would let you route $_GET query parameters.

Such a route would look like this: 'urlPart/:anotherUrlPart?obligatoryParam=1&controller=:controller&:action=:action', which would match /urlPart/value?controller=cont&action=act&obligatoryParam=1&unneededGetParam=2. As you can see, the order doesn't matter as long as all the needed parameters are there, and values that do not begin with a colon must equal the value given in the route. Also, any unnecessary parameters are ignored and do not cause the match to fail.

I've also included a few test, although it may be possible that more would be necessary. I also haven't written any documentation.