iakio / htmlhelper
Simple secure HtmlHelper
0.1.0
2014-05-09 14:11 UTC
Requires (Dev)
- phpunit/phpunit: 4.1.*
This package is not auto-updated.
Last update: 2024-12-21 16:15:30 UTC
README
Simple secure HtmlHelper.
Features:
- Auto escaping.
- Fluent interface.
Usage:
<?php require 'vendor/autoload.php'; use iakio\htmlhelper\HtmlHelper; $html = new HtmlHelper; echo $html->h1('Hello, World'), "\n"; // instance method // <h1>Hello, World</h1> echo HtmlHelper::h1('Hello, World'), "\n"; // or static method // <h1>Hello, World</h1> echo HtmlHelper::a('set attributes', ['href' => 'http://github.com']), "\n"; // <a href="http://github.com">set attributes</a> echo HtmlHelper::a() ->append('fluent') ->append(' interface') ->attr('href', 'http://github.com'), "\n"; // <a href="http://github.com">fluent interface</a> echo HtmlHelper::span(['Auto <escape>', HtmlHelper::i('& nested tag')]), "\n"; // <span>Auto <escape><i>& nested tag</i></span>