Full site url in Slim Framework 4

Hello! I upgraded to Slim Framework 4 + slim / twig 3 + slim / psr7. My task required using the full path to the site (for example, http://example.com/test) in the twig template. Tell me how can I do this? I looked at the TwigExtension class, but there is only the full_url_for function, it is not suitable for my task. I need exactly the current full path. Or at least just the full path of the site, so that I can then add the relative to it via current_url.

Thanks!

To get the current URL you can try {{ get_uri() }}

Get the current URL path: {{ get_uri().getPath() }}

Slim Twig View Template Functions

1 Like

Thanks, so much!

Regards, Mark.

1 Like