Skip to content

Commit

Permalink
Add example for multiple optional parts
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Apr 18, 2016
1 parent 5e1f431 commit 79843dc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -109,6 +109,9 @@ $r->addRoute('GET', '/user/{id:\d+}[/{name}]', 'handler');
$r->addRoute('GET', '/user/{id:\d+}', 'handler');
$r->addRoute('GET', '/user/{id:\d+}/{name}', 'handler');

// Multiple nested optional parts are possible as well
$r->addRoute('GET', '/user[/{id:\d+}[/{name}]]', 'handler');

// This route is NOT valid, because optional parts can only occur at the end
$r->addRoute('GET', '/user[/{id:\d+}]/{name}', 'handler');
```
Expand Down

0 comments on commit 79843dc

Please sign in to comment.