1. Go to this page and download the library: Download yukanoe/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/ */
yukanoe / html example snippets
use Yukanoe\HTML\Tag;
$myTag = new Tag(string $name='', array $attribute=[], string $text='');
# index.php
L\Tag;
$html = new Tag('html', [], '');
$head = new Tag('head', [], '');
$title = new Tag('title', [], 'Page Title');
$body = new Tag('body', [], '');
$div = new Tag('div', ['class'=>'ruby'], '');
$h1 = new Tag('h1', [], 'Hello World!');
$p = new Tag('p', [], 'This is a paragraph.');
$html->addChild([$head, $body]);
$head->addChild($title);
$body->addChild($div);
$div->addChild([$h1, $p]);
$myTag->name = "div"
// class attribute
$myTag->attribute['class'] = 'card';
// all attribute
$myTag->attribute = ['class'=>'card'];
// text
$myTag->text = 'string 123456789';