How i can get the twig handly functions? ie url_for

i cant get the twig handly functions, this is my views conf file

<?php
declare(strict_types=1);

use Slim\App;
use Slim\Views\Twig;
use Slim\Views\TwigMiddleware;
use Slim\Views\TwigExtension;
use Twig\Loader\FileSystemLoader;

return function( App $app ) {

    $container = $app->getContainer();

    $container->set('view', function() use ($container) {
        $settings = $container->get('settings')['views'];
        $loader = new FileSystemLoader($settings['path']);

        // $uri = \Slim\Http\Uri::createFromEnvironment(new \Slim\Http\Environment($_SERVER));    <-- this raise an error slim\http\uri dosent exists
        //
        $view = new Twig($loader, $settings['settings']);
        $view->AddExtension(new TwigExtension (
            $container->router,
            $container->request->getUri().   <-- this raise an error "Call to a member function getUri() on null "
        ));

        // $ext = new TwigExtension;
        // $ext->getFunctions();
        //
        // print_r($ext->getFunctions());die;

        return $view;

        return new Twig($loader, $settings['settings']);

    });



    $container->set('viewMiddleware', function() use ($app, $container) {
        return new TwigMiddleware($container->get('view'), $app->getRouteCollector()->getRouteParser());
    });
};

any idea? i working on slim v4 and twig 3.2
thanks

Just install the TwigExtension for Slim 4 and use the url_for() function and other helper.