PHP code example of danielescherzer / html-builder

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

    

danielescherzer / html-builder example snippets


use DanielEScherzer\HTMLBuilder\FluentHTML;

$result = FluentHTML::fromTag( 'form' )
    ->setAttribute( 'id', 'submission-form' )
    ->setAttribute( 'class', [ 'my-project-forms', 'example-form' ] )
    ->addChild(
        FluentHTML::fromTag( 'label' )
            ->setAttribute( 'for', 'username-input' )
            ->addChild(
                '<username>'
            )
    )
    ->addChild(
        FluentHTML::fromTag( 'input' )
            ->setAttribute( 'type', 'text' )
            ->setAttribute( 'name', 'username' )
            ->setAttribute( 'id', 'username-input' )
    )
    ->addChild(
        FluentHTML::fromTag( 'button' )
            ->setAttribute( 'type', 'submit' )
            ->setAttribute( 'disabled', true )
            ->addClass( 'btn-submit' )
            ->addChild( 'Submit' )
    )
    ->getHTML();