PHP code example of iakio / htmlhelper

1. Go to this page and download the library: Download iakio/htmlhelper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

iakio / htmlhelper example snippets



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 &lt;escape&gt;<i>&amp; nested tag</i></span>