opis/view

A rendering engine that can be integrated with multiple template engines simultaneously

Installs: 85

Dependents: 1

Stars: 2

Watchers: 1

Language: PHP

2.5.0 2015-03-20 15:07 UTC

README

Latest Stable Version Latest Unstable Version License

A must have view component that can be integrated with multiple rendering engines simultaneously.

Installation

This library is available on Packagist and can be installed using Composer

{
    "require": {
        "opis/view": "2.5.*"
    }
}

Documentation

Examples

use Opis\View\ViewRouter;
use Opis\View\View;

$router = new ViewRouter();

$router->handle('view.{name}', function($name){
    return  '/some/path/' . $name . '.php';
})
->where('name', 'welcome|account');

print $router->renderView('view.welcome');
//Or..
print $router->render(new View('view.welcome'));

//Serialize and unserialize

$router = unserialize(serialize($router));

print $router->renderView('view.account', array('user' => 'Opis'));
//Or..
print $router->render(new View('view.account', array('user' => 'Opis')));