silassare / otpl
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
2.0.1
2026-03-08 18:16 UTC
Requires
- php: >=8.1
- silassare/php-utils: ^2.0.0
Requires (Dev)
- oliup/oliup-cs-php: dev-main
- phpunit/phpunit: ^9.5.26
- roave/security-advisories: dev-latest
- vimeo/psalm: ^5.26.1
This package is auto-updated.
Last update: 2026-03-08 18:17:11 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" />