mrjulio / rapture-template
Rapture template component
v1.0.3
2017-11-18 21:00 UTC
Requires
- php: >=5.4.0
- mustache/mustache: ~2.11
This package is not auto-updated.
Last update: 2024-10-27 05:30:51 UTC
README
Simple templates for PHP.
Requirements
- PHP v5.4.0
Install
composer require mrjulio/rapture-template
Quick start
$tpl = new Phtml('templates/home', ['nickname' => 'John']); echo $tpl->render();
Layout
<!doctype html> <html> <head> <title><?= $t->title ?></title> </head> <body> <!-- current scope --> <?php include $t->name('partials/header') ?> <div id="container"> <?= $t->content ?> </div> <!-- partials scope --> <?= $t->insert('partials/footer', ['title' => $t->title]) ?> </body> </html>
Template
<?php $t->title = 'Test Title'; ?> <div id="container"> <!-- escape and filter --> <h2>Hello <?= $t->e($nickname, 'strtolower|ucfirst') ?>!</h2> </div>
About
Author
Iulian N. rapture@iuliann.ro
Testing
cd ./test && phpunit
Credits
License
Rapture Template is licensed under the MIT License - see the LICENSE
file for details.