$view->addExtension work, why $view->addFilter doesn't?

Hi @brainstorm.

$view->addExtension works but for ->addFilter I need $view->getEnvironment()->addFilter.

Why this?

Because you’re adding the filter to the environment. This is a Twig thing, not Slim. You can read about it in the Twig docs: Extending Twig - Documentation - Twig - The flexible, fast, and secure PHP template engine