An easy to use HTML (and XML) builder and template library.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
scripts
src/Concerto/HtmlTemplates
tests
.gitignore
.travis.yml
composer.json
phpunit.xml
readme.md

readme.md

HTML Templates Component

An easy to use HTML (and XML) builder and template library.

Build Status

Install

The recommended way to install Text Expressions is through composer.

{
    "require": {
        "concerto/html-templates": "0.*"
    }
}

Usage

Set a text value:

use Concerto\HtmlTemplates\Template;

$tpl = new Template();
$tpl->openString('<p />');
$tpl('p')->set('PHP <3');

$tpl->render();
// > <p>PHP &lt;3</p>

Set a HTML value:

$tpl = new Template();
$tpl->openString('<p />');
$tpl('p')->set('PHP &lt;3', true);

$tpl->render();
// > <p>PHP &lt;3</p>

Expand a list:

$tpl = new Template();
$tpl->openString('<ol><li /></ol>');
$tpl('ol/li')->expand(['One', 'Two', 'Three!']);

$tpl->render();
// > <ol><li>One</li><li>Two</li><li>Three!</li></ol>