Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions 03-routing/13-groups/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,20 @@ The routes defined above would be accessible at, respectively:

Route groups are very useful to group related routes and avoid repeating common URL segments
for each route definition.

Parameters contained in the group portion of the route will be passed to the child routes like this:

<?php
$app = new \Slim\Slim();

// Users group
$app->group('/users/:userId', function () use ($app) {

// User Posts group
$app->get('/posts/:postId', function ($userId, $postId) use ($app) {

// this route can access both $userId and $postId

}
}