piotrpress/templater

This library is a simple template engine file loader with variable support.

v1.1.0 2022-02-22 16:26 UTC

This package is auto-updated.

Last update: 2024-04-22 20:58:29 UTC


README

This library is a simple template engine file loader with variable support.

Installation

composer require piotrpress/templater

Usage

require __DIR__ . '/vendor/autoload.php';

use PiotrPress\Templater;

$templater = new Templater( '/templates' );

// print
$templater->display( 'template', [
    'var1' => 'value1',
    'var2' => 'value2'
] );

// return
echo $templater->render( 'template', [
    'var1' => 'value1',
    'var2' => 'value2'
] );

Note: All Errors in templates will be converted to Exceptions.

License

GPL3.0