dtkahl / php-simple-view
1.5.0
2016-09-04 06:17 UTC
Requires
- php: >=5.6.0
Requires (Dev)
- phpunit/phpunit: 5.2.*
README
PHP simple view
Simple PHP view renderer.
Dependencies
PHP >= 5.6.0
Installation
Install with Composer:
composer require dtkahl/php-simple-view
Usage
anywhere in PHP
$renderer = new \Dtkahl\SimpleView\ViewRenderer(__DIR__.'/views/');
echo $render->render('example.php', ['name' => 'test']);
/views/example.php
<!DOCTYPE html>
<html>
<head></head>
<body><?php echo $name ?></body>
<html>
Methods
addViewPaths($paths)
add Path(s) where render should search for view files. Returns renderer instance.
####render(string $file, array $data = [])
render given view file with given data (as local vars).