Path Parameters
Follow either link and the page shows the year, month and slug it read from the URL. The blog route calls $c->getPathParam(); the article route gets the values as arguments of its handler.
{year}/{month}/{slug} placeholders in the route pattern are captured and passed to your handler automatically.
Two access styles: call
$c->getPathParam() manually, or let Via inject matching parameters directly into your callback's function signature.Reflection-based injection matches parameter names to route placeholders. Type-hint
int and Via casts the value for you, no manual parsing required.year: 2025
month: 01
slug: testing
All three parameters auto-injected into the function signature.
Views
path_params.html.twig
Landing page with links to both blog (manual) and article (auto-injection) routes.
path_params_detail.html.twig
Detail page showing extracted year, month, and slug from the URL.