Skip to content

Configuration

group()

group() — returns struct

Available in: mapper Category: Routing

Group routes together with shared attributes like path prefix, name prefix, and constraints without implying a controller package or namespace. Unlike namespace() (which maps to a subfolder and URL prefix) or package() (which maps to a subfolder), group() is a pure organizational grouping mechanism.

NameTypeRequiredDefaultDescription
namestringnoName to prepend to child route names for use when building links, forms, and other URLs.
pathstringnoURL path prefix to apply to all child routes.
constraintsstructnoVariable patterns (regex constraints) to apply to all child routes.
callbackanynoA callback function to define nested routes within this group. If provided, the group is automatically closed when the callback completes.