PHPackages                             sevenphp/savantphp - 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. sevenphp/savantphp

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

sevenphp/savantphp
==================

Savant (SavantPHP) is a simple and minimalistic, yet object-oriented, Templating System For PHP minimalist. It aims at ONE thing, being a simple lightweight TEMPLATING system. The focus is on ONE thing - PHP can do everything, so do everything with PHP, just use SavantPHP for only separating the 'view/templating' concern from your business logic. Hence the philosophy of 'I just want to separate my front layer(view) from the back layer(code logic) in the most simple &amp; effective way &amp; that's it, nothing more, nothing less, nothing else (no added crap)'

3.0.1(9y ago)43.9k2MITPHPPHP &gt;=5.5.0

Since Dec 22Pushed 9y ago2 watchersCompare

[ Source](https://github.com/wkhayrattee/SavantPHP)[ Packagist](https://packagist.org/packages/sevenphp/savantphp)[ RSS](/packages/sevenphp-savantphp/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (5)Used By (0)

SavantPHP - The Simplest Templating System For PHP minimalist
=============================================================

[](#savantphp---the-simplest-templating-system-for-php-minimalist)

SavantPHP is a simple and minimalistic, yet object-oriented, template system for PHP. It aims at ONE thing, being a simple &amp; lightweight TEMPLATING system. We focus only on that ONE thing. PHP can do everything, so do everything with it, just use SavantPHP for only separating the "view/templating" concern from your business logic, that's it.

It has a proper **namespace** support and installable nicely via **composer** (unlike it's previous oldish one - see Credit section below)

Unlike other template systems, SavantPHP does not compile your templates into PHP; instead, it uses PHP itself as its template language so you don't need to learn a new markup system and you can use and access any method or functions within your app inside those template.

It is not a competitor to any of the likes of Dwoo or Twig..etc. SavantPHP is for those PHP/templating minimalists - **"I just want to separate my front layer(view) from the back layer(code logic)" in the most simple and effective way and that's it, nothing more, nothing less, nothing else (no added crap).**

How To Install SavantPHP
------------------------

[](#how-to-install-savantphp)

```
$ composer require sevenphp/savantphp
```

### Why Use SavantPHP for Templates?

[](#why-use-savantphp-for-templates)

- Has **namespace** support
- Is installable via **composer**
- Is not jammed with lots of wrappers, inbuilt compiling..etc like others
- The code footprint is small and you can easily follow through the Classes and get the hang of it quickly
- You don't need to learn a new language or markup to create a template. The template language is PHP, and the template file is a regular PHP file.
- Because your template script is a regular PHP script, you can sprinkle it with comments and use phpDocumentor to document it.
- No need to assign variable to an array before you can use it inside your template. **The variable usage is direct** and simple. (see example code below)

Example:

```
/* file.php */

use SavantPHP\SavantPHP;
$yourConfigBag = [
    \SavantPHP\SavantPHP::TPL_PATH_LIST => ['/path/to/yourViews/', '/path/to/someOtherFolder/anotherViewFolder/'], //as you can see, set all possible places where your template will reside
    \SavantPHP\SavantPHP::CONTAINER     => $yourContainer //can be anything, e.g a pimple container
];
$tpl = new SavantPHP($yourConfigBag);
$tpl->mynameis = 'Wasseem';

$tpl->setTemplate('file.tpl.php');
$tpl->display(); //or $response = $tpl->getOutput();
```

```
/* file.tpl.php | See how other **master templates** are also included within a template */

    Hello, my name is
