PHP code example of alex-yashin / php-simple-html

1. Go to this page and download the library: Download alex-yashin/php-simple-html 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/ */

    

alex-yashin / php-simple-html example snippets


Html::nest($path, $content = '', $rootOptions = [])

echo Html::nest('div#my-wrapper/a#my.link[href=#][title=my link]')
//<div id="my-wrapper"><a id="my" class="link" href="#" title="my link"></a></div>

echo Html::nest('.step/.circle+p', 10) 
//<div class="step"><div class="circle"></div><p>10</p></div>

echo Html::nest('div/span[disabled]', 'hello!');
//<div><span disabled="disabled">hello!</span></div>

echo Html::nest('.step/.circle+p', 10, ['class' => 'active'])
//<div class="step active"><div class="circle"></div><p>10</p></div>

Html::zz($template, ...$items)

echo Html::zz('.circle([data-name=%]+.round%+p)+span%', 'step', 10, 20);
//<div class="circle"><div data-name="step"></div><div class="round">10</div><p></p></div><span>20</span>

echo Html::zz('input.quantity-field[type=number][name=quantity][step=1][readonly][data-sku=%]', 'SKU');
//<input type="number" class="quantity-field" name="quantity" readonly="readonly" step="1" data-sku="SKU">

echo Html::br();
//<br>

Html::li($content = '', $options = []);

echo Html::li('test', ['class' => 'active']);
//<li class="active">test</li>