PHPackages                             roolith/template-engine - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. roolith/template-engine

ActiveLibrary[Templating &amp; Views](/categories/templating)

roolith/template-engine
=======================

PHP simple template engine

1.0.4(11mo ago)1831MITPHP

Since Aug 30Pushed 11mo ago2 watchersCompare

[ Source](https://github.com/im4aLL/roolith-template-engine)[ Packagist](https://packagist.org/packages/roolith/template-engine)[ RSS](/packages/roolith-template-engine/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (6)Used By (1)

roolith-template-engine
=======================

[](#roolith-template-engine)

No overcomplicated stuff! Just plain PHP in template file. No `eval`, it uses output buffering!

#### Install

[](#install)

```
composer install roolith/template-engine

```

#### Usage

[](#usage)

```
$view = new \Roolith\Template\Engine\View(__DIR__ . '/views');

try {
    $data = [
        'content' => 'home content',
        'title' => 'home page',
    ];

    echo $view->compile('home', $data);
} catch (\Roolith\Template\Engine\Exceptions\Exception $e) {
    echo $e->getMessage();
}
```

`views` folder contains -

```
home.php
partials/header.php
partials/footer.php

```

Where `home.php`

```
