I looked around for the code to get the current path in a Twig template (and not the full URL), i.e.
I don\'t want http://www.sitename.com/page
, I only need
If you are using Silex 2 you can not access the Request object anymore.
You can access the current request attributes this way.
app.request_stack.currentrequest.attributes.get('_route')
And to generate the full current URL :
path(app.request_stack.currentrequest.attributes.get('_route'), app.request_stack.currentrequest.attributes.get('_route_params'))