Get current URI in Twig template

Does anyone know how to get the current URI in a Twig template?

I read the documentation and Im could not find the Twig function for this.

+6
source share
1 answer
{{ app.request.uri }} 

If you want to read it in a variable of the form:

 {% set uri = app.request.uri %} 

The app global variable contains all sorts of useful shortcuts, such as app.session and app.security.token.user , which refer to services that you can use in the controller.

+12
source

Source: https://habr.com/ru/post/899992/


All Articles