How can I use an environment variable from the .env
file in a custom Twig function (\Twig_SimpleFunction
) in Symfony 4?
It's possible to access env vars in a twig template without any additional configuration:
{{ app.request.server.get('MY_ENV_VAR') }}