PHP code example of tyokinuhata / html-builder

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

    

tyokinuhata / html-builder example snippets




 new HtmlBuilder\HtmlBuilder();

$hb
->html('lang', 'ja')
    ->head()
        ->meta('charset', 'utf-8')
        ->title()
            ->text('タイトル')->upstream()
        ->style([
            '#title' => [
                'color' => 'white',
                'background' => 'red'
            ],
            '#content' => [
                'color' => 'green',
                'background' => 'blue'
            ]
        ])->upstream()
    ->body()
        ->h1('id', 'title')
            ->text('見出し')->upstream()
        ->p('id', 'content')
            ->text('本文')->upstream()
        ->input('type', 'text', '@autofocus')
        ->button('type', 'submit')
            ->text('送信')->append();
bash
$ php -S localhost:8000 index.php