code: public function register(SilexApp $app) {
          $app['twig'] = $app->share($app->extend('twig', function (\Twig_Environment $twig, SilexApp $app) {
              $class = $this->getServiceConfig()->getProviderClass();
              $twig->addExtension(new $class);
  
              return $twig;
          }));
      }
docs: Extend Twig Environment with provided Extension.
  
  @param SilexApp $app
  
  @return void