Yii's named parameters are available in the template. For example, for the following route configuration:
'post/<post_id:\d+>' => ['template' => 'post-entry'],
The value of post_id
in my template for the request post/3
will be 3
.
But how can I access it from PHP, for example from the Craft::app -> getRequest()
?
Note: I don't mean queryString parameters. QueryString parameters can be accessed using getParam('paramName')
.