PHP code example of mouf / html.tags

1. Go to this page and download the library: Download mouf/html.tags 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/ */

    

mouf / html.tags example snippets


$div = new Div();
$div->setId('myDiv');
$div->toHtml();

$input = new Input();
$input->setType('text')->setName('company')->setLabel('TheCodingMachine');
$input->toHtml();

$label = new Label();
$label->setClasses(array("css-class1 css-class2"));
$label->setStyles(array("background-color" => "red"));
$label->toHtml();

$label->addClass("css-class3");
$label->addStyle("background-color", "red");

$div->setChildren(array($label, $input));

$div->addChild($label);

$p = new Paragraph();
$p->addText("This is my text");

// Similar to:
$p->addChild(new HtmlString("This is my text"));