src/Compilers/TwigCompiler.php
public function getTwigCompiler($loader)
    {
        $this->twig = new Twig_Environment($loader, array(
           'cache'       => storage_path().'/views',
           'autoescape'  => false,
           'auto_reload' => true
        ));

        // Hook twig to do what you want.
        $hooks = $this->config->get('theme.engines.twig.hooks');
        $this->twig = $hooks($this->twig);

        // Get facades aliases.
        $aliases = $this->config->get('app.aliases');

        // Laravel alias to allow.
        $allows = $this->config->get('theme.engines.twig.allows');

        foreach ($aliases as $alias => $class)
        {
            // Nothing allow if not exists in twig config.
            if ( ! in_array($alias, $allows)) continue;

            // Clasname with namspacing.
            $className = '\\'.$alias;

            // Some method is not in facade like Str.
            if ( ! method_exists($className, 'getFacadeRoot'))
            {
                $this->twig->addGlobal($alias, new $className());
            }
            // Method support real facade.
            else
            {
                $this->twig->addGlobal($alias, $className::getFacadeRoot());
            }
        }

        /*$function = new Twig_SimpleFunction('call', function($function)
        {
            $args = func_get_args();
            $args = array_splice($args, 1);

            return call_user_func_array($function, $args);
        });

        $this->twig->addFunction($function);*/

        return $this->twig;
    }
public function getTwigCompiler($loader)
    {
        $this->twig = new Twig_Environment($loader, array(
           'cache'       => storage_path().'/views',
           'autoescape'  => false,
           'auto_reload' => true
        ));

        // Hook twig to do what you want.
        $hooks = $this->config->get('theme.engines.twig.hooks');
        $this->twig = $hooks($this->twig);

        // Get facades aliases.
        $aliases = $this->config->get('app.aliases');

        // Laravel alias to allow.
        $allows = $this->config->get('theme.engines.twig.allows');

        foreach ($aliases as $alias => $class)
        {
            // Nothing allow if not exists in twig config.
            if ( ! in_array($alias, $allows)) continue;

            // Clasname with namspacing.
            $className = '\\'.$alias;

            // Some method is not in facade like Str.
            if ( ! method_exists($className, 'getFacadeRoot'))
            {
                $this->twig->addGlobal($alias, new $className());
            }
            // Method support real facade.
            else
            {
                $this->twig->addGlobal($alias, $className::getFacadeRoot());
            }
        }

        /*$function = new Twig_SimpleFunction('call', function($function)
        {
            $args = func_get_args();
            $args = array_splice($args, 1);

            return call_user_func_array($function, $args);
        });

        $this->twig->addFunction($function);*/

        return $this->twig;
    }
public function getTwigCompiler ( $ loader ) { $ this -> twig = new Twig_Environment ( $ loader , array ( 'cache' => storage_path ( ) . '/views' , 'autoescape' => false , 'auto_reload' => true ) ) ; // Hook twig to do what you want. $ hooks = $ this -> config -> get ( 'theme.engines.twig.hooks' ) ; $ this -> twig = $ hooks ( $ this -> twig ) ; // Get facades aliases. $ aliases = $ this -> config -> get ( 'app.aliases' ) ; // Laravel alias to allow. $ allows = $ this -> config -> get ( 'theme.engines.twig.allows' ) ; foreach ( $ aliases as $ alias => $ class ) { // Nothing allow if not exists in twig config. if ( ! in_array ( $ alias , $ allows ) ) continue ; // Clasname with namspacing. $ className = '\\' . $ alias ; // Some method is not in facade like Str. if ( ! method_exists ( $ className , 'getFacadeRoot' ) ) { $ this -> twig -> addGlobal ( $ alias , new $ className ( ) ) ; } // Method support real facade. else { $ this -> twig -> addGlobal ( $ alias , $ className :: getFacadeRoot ( ) ) ; } } /*$function = new Twig_SimpleFunction('call', function($function)
        {
            $args = func_get_args();
            $args = array_splice($args, 1);

            return call_user_func_array($function, $args);
        });

        $this->twig->addFunction($function);*/ return $ this -> twig ; }
Twig compiler.

@param  Twig_Loader_Filesystem $loader
@return Twig_Environment
Twig compiler .