PHP code example of royallthefourth / html-document

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

    

royallthefourth / html-document example snippets


use RoyallTheFourth\HtmlDocument\Document;
use RoyallTheFourth\HtmlDocument\Element\Body;
use RoyallTheFourth\HtmlDocument\Element\Head;
use RoyallTheFourth\HtmlDocument\Element\Html;
use RoyallTheFourth\HtmlDocument\Element\Paragraph;
use RoyallTheFourth\HtmlDocument\Element\Text;
use RoyallTheFourth\HtmlDocument\Element\Title;

echo (new Document())
    ->add((new Html())
        ->withChild((new Head())
            ->withChild((new Title())
                ->withChild(new Text('HTML Document'))
            )
        )
        ->withChild((new Body())
            ->withChild((new Paragraph())
                ->withChild(new Text('Build a whole document at once like this, or piece existing parts together'))
            )
        )
    )->render();