This package is abandoned and no longer maintained. The author suggests using the https://github.com/silassare/blate package instead.

[DEPRECATED] A simple template system write once run everywhere! Use silassare/blate instead: https://github.com/silassare/blate

Maintainers

Package info

github.com/silassare/otpl-php

Homepage

pkg:composer/silassare/otpl

Statistics

Installs: 295

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

2.0.1 2026-03-08 18:16 UTC

README

Warning

This project is deprecated and no longer maintained. The repository has been archived. No further updates, bug fixes, or support will be provided.

We recommend migrating to silassare/blate as a replacement.

A simple template system, write once run everywhere with JavaScript (nodejs or in browser ), PHP ...

Related projects

Setup with composer

$ composer require silassare/otpl-php

Use case

Input: your template.otpl file content

<label for="<% $.input.id %>"><% $.label.text %></label>
<input <% @HtmlSetAttr($.input) %> />

Usage: php

<?php

require_once "vendor/autoload.php";

$otpl = new \OTpl\OTpl();
$otpl->parse('template.otpl');
$data = array(
	'label' => array(
		'text' => 'Your password please :',
	),
	'input' => array(
		'id' => 'pass_field',
		'type' => 'password',
		'name' => 'pass'
	)
);

$otpl->runWith($data);

Output

<label for="pass_field">Your password please :</label>
<input type="password" id="pass_field" name="pass" />