PHPackages                             zver/view - 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. zver/view

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

zver/view
=========

Template engine with auto escaping html entities and with full PHP-native code support

2.0.0(7y ago)0130PHP

Since Jun 23Pushed 7y ago1 watchersCompare

[ Source](https://github.com/s4urp8n/view)[ Packagist](https://packagist.org/packages/zver/view)[ RSS](/packages/zver-view/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (8)DependenciesVersions (9)Used By (0)

Zver\\View [![Build Status](https://camo.githubusercontent.com/b66017a20ec854984d07ce02dfa42d6552504d950bf1ee809897fee93bb05cf8/68747470733a2f2f7472617669732d63692e6f72672f7334757270386e2f766965772e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/s4urp8n/view)
==============================================================================================================================================================================================================================================================================

[](#zverview-)

Template engine with auto escaping html entities and with full PHP-native code support

Install
-------

[](#install)

```
composer require zver/view

```

Examples
--------

[](#examples)

#### Loading from string

[](#loading-from-string)

```
  $html=View::loadFromString('{{ $caption}}   ')
                ->set('caption', 1)
                ->set('caption2', 'hello')
                ->set('caption3', 'meet')
                ->render();
```

#### Loading from file

[](#loading-from-file)

```
  $html=View::loadFromFile($filename)
                ->set('caption', 1)
                ->render();
```

#### Autodetect loading (file or string)

[](#autodetect-loading-file-or-string)

```
  $html=View::load($filenameOrString)
                ->set('caption', 1)
                ->render();
```

#### Views directories

[](#views-directories)

You can add directories to search views files, instead of passing absolute filename as argument

**Last added dir is first to search**

Absolute paths also works anyway

```
   View::addViewsDirectory(dir1);
   View::addViewsDirectory(dir2);
   View::addViewsDirectory(dir3);
