I want to add base64 encode decode filter in twig. But it's showing Unknown "base64_encode" filter. in Twig\ExpressionParser->getFilterNodeClass()
I have tried with below filter but nothing works.
{% set youtube_id = content.field_youtube_embed_code|render|striptags|trim %}
{{ youtube_id|base64_encode }}
<p>{{ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi dapibus.'|base64_encode }}</p>
This filter is a part of Symfony2 but unfortunately not a part of Drupal Twig package. If you want to use it the simpliest way is to create your own module with something like this (it's just an untested mockup, please review before implementing)
alternatively
Twig Tweakmodule PHP filter might do what you want.