Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Slim View

Inject any rendering engine into your Slim View. Multiple engines are supported and the view will fall back to standard PHP templates if a template cannot be resolved.

Usage

Add the following in your root composer.json file:

{
    "require": {
        "frizzy/slim-view": "0.*"
    }
}

Adding Twig to your view:

$view   = new \Frizzy\Slim\View\View;
$loader = new \Twig_Loader_Filesystem(__DIR__ . '/my_templates'); 

$view->setRenderEngine(
    new \Twig_Environment($loader),
    function ($engine, $template, $data) {        
        return $engine->loadTemplate($template)->render($data); 
    },
    function ($template) {
        return preg_match('/\.twig$/', $template);
    }
);

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages