anandkunal / ToroPHP

Toro is a PHP router for developing RESTful web applications and APIs.
http://toroweb.org
MIT License
1.17k stars 173 forks source link

Pass captured regex values to route handler defined as functions. #86

Open jbottigliero opened 10 years ago

jbottigliero commented 10 years ago

This update allows $regex_matches to be passed to handler methods the same way they are called when using a class handler.

For example:

'/route/([page1/page2/page3])+)' => function ($page) {
 switch($page) {
  case 'page1':
  break;
  case 'page2':
  break;
 }
},
'/another/:number' => function ($number) { ... }