dtkahl/php-simple-view

1.5.0 2016-09-04 06:17 UTC

This package is auto-updated.

Last update: 2024-11-29 04:36:56 UTC


README

Latest Stable Version License Build Status

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).