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
namestringno—Name to prepend to child route names for use when building links, forms, and other URLs.
pathstringno—URL path prefix to apply to all child routes.
constraintsstructno—Variable patterns (regex constraints) to apply to all child routes.
callbackanyno—A callback function to define nested routes within this group. If provided, the group is automatically closed when the callback completes.