Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.
/ PHPTAL-View Public archive
forked from slimphp/PHP-View

A Simple PHP Renderer for Slim3

License

Notifications You must be signed in to change notification settings

jsangradorp/PHPTAL-View

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Development of this fork has been moved to https://gitlab.com/jsangradorp/PHPTAL-View

PHPTAL Renderer

This is a renderer for rendering PHPTAL view scripts into a PSR-7 Response object. It works well with Slim Framework 3.

Installation

Install with Composer:

composer require jsangrador/PHPTAL-view

Usage With Slim 3

use Slim\Views\PhpTalRenderer;

include "vendor/autoload.php";

$app = new Slim\App();
$container = $app->getContainer();
$container['renderer'] = new PhpTalRenderer("./templates");

$app->get('/hello/{name}', function ($request, $response, $args) {
    return $this->renderer->render($response, "/hello.html", $args);
});

$app->run();

Usage with any PSR-7 Project

//Construct the View
$phpView = new PhpTalRenderer("./path/to/templates");

//Render a Template
$response = $phpView->render(new Response(), "/path/to/template.html", $yourData);

Exceptions

\RuntimeException - if template does not exist

\InvalidArgumentException - if $data contains 'template'

About

A Simple PHP Renderer for Slim3

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 98.8%
  • HTML 1.2%