src/View/ViewServiceProvider.php
public function registerTwigEnvironment()
    {
        $this->app->singleton('twig', function ($app) {
            $twig = new \Twig_Environment(
                $app['twig.loader'],
                [
                    'auto_reload' => true,
                    'cache' => $app['config']['view.twig']
                ]
            );

            // Add Twig Debug Extension
            $twig->addExtension(new \Twig_Extension_Debug());

            // Enable debug.
            if ($app['config']['app.debug']) {
                $twig->enableDebug();
            }

            // Add WordPress helpers extension.
            $twig->addExtension(new WordPress());

            return $twig;
        });
    }
public function registerTwigEnvironment()
    {
        $this->app->singleton('twig', function ($app) {
            $twig = new \Twig_Environment(
                $app['twig.loader'],
                [
                    'auto_reload' => true,
                    'cache' => $app['config']['view.twig']
                ]
            );

            // Add Twig Debug Extension
            $twig->addExtension(new \Twig_Extension_Debug());

            // Enable debug.
            if ($app['config']['app.debug']) {
                $twig->enableDebug();
            }

            // Add WordPress helpers extension.
            $twig->addExtension(new WordPress());

            return $twig;
        });
    }
public function registerTwigEnvironment ( ) { $ this -> app -> singleton ( 'twig' , function ( $ app ) { $ twig = new \ Twig_Environment ( $ app [ 'twig.loader' ] , [ 'auto_reload' => true , 'cache' => $ app [ 'config' ] [ 'view.twig' ] ] ) ; // Add Twig Debug Extension $ twig -> addExtension ( new \ Twig_Extension_Debug ( ) ) ; // Enable debug. if ( $ app [ 'config' ] [ 'app.debug' ] ) { $ twig -> enableDebug ( ) ; } // Add WordPress helpers extension. $ twig -> addExtension ( new WordPress ( ) ) ; return $ twig ; } ) ; }
Register Twig Environment.
Register Twig Environment .