Skip to content

Clarify how group parameters are received by callables #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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

}
}