## PHP Renderer This is a renderer for rendering PHP view scripts into a PSR-7 Response object. It works well with Slim Framework 3. ## Usage With Slim 3 ```php use Slim\Views\PhpRenderer; include "vendor/autoload.php"; $app = new Slim\App(); $container = $app->getContainer(); $container['renderer'] = new PhpRenderer("./templates"); $app->get('/hello/{name}', function ($request, $response, $args) { return $this->renderer->render($response, "/hello.php", $args); }); $app->run(); ``` ## Usage with any PSR-7 Project ```php //Construct the View $phpView = new PhpRenderer("./path/to/templates"); //Render a Template $response = $phpView->render(new Response(), "/path/to/template.php", $yourData); ``` ## Exceptions `\RuntimeException` - if template does not exist `\InvalidArgumentException` - if $data contains 'template'