h4d/template

Basic PHP template system

Maintainers

Details

github.com/h4d/template

Source

Issues

Installs: 253

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/h4d/template

v1.0.4 2018-05-20 14:06 UTC

This package is not auto-updated.

Last update: 2025-09-28 01:38:54 UTC


README

This is a very basic PHP library that helps you work with plain text format templates (txt, html, etc).

Install via composer:

Install the latest version with

$ composer require h4d/template

Basic usage examples

Using constructor

<?php
// Create a template
$template = new \H4D\Template\Template();
// Add vars to the template object
$template->addVar('name', 'WORLD');
// Render using the given file as template
echo $template->render('./template.txt');

Using static method (the fast way)

<?php
// Create a template & set the template file
$template = \H4D\Template\Template::create('./template.txt');
// Add vars to the template object
$template->addVar('name', '(static) WORLD');
// Render template (automagically cast to string)
echo $template;