Examples menu

Path Parameters

Dynamic routing with automatic type-cast parameter injection.

{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.