1. Go to this page and download the library: Download avplab/php-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/ */
avplab / php-html-builder example snippets
$builder = new \AvpLab\PhpHtmlBuilder();
$builder
->tag('!DOCTYPE')->setHtml()->endOpened()
->html()->setLang('en')
->head()
->meta()->setHttpEquiv('X-UA-Compatible')->setContent('IE=edge,chrome=1')->endOpened()
->title('PhpHtmlBuilder: Example')->end()
->end()
->body()
->div()->setClass('container')
->div()->setClass('row')
->div()->setClass('col-md-12')
->h1('PhpHtmlBuilder Demo')->end()
->p('Designed to make the code easier')->end()
->end()
->end()
->end()
->end()
->end();
echo $builder;
$builder = new \AvpLab\PhpHtmlBuilder();
echo $builder->html()->customTag()->end()->end();
//Result
<html><custom-tag></custom-tag></html>
$builder = new \AvpLab\PhpHtmlBuilder();
echo $builder->tag('!DOCTYPE')->endOpened();
//Result
<!DOCTYPE>
$builder = new \AvpLab\PhpHtmlBuilder();
// Do some html
$htmlString = $builder->build();
echo $htmlString;
// Supports string recognision
echo $builder;
$builder = new \AvpLab\PhpHtmlBuilder();
echo $builder->addComment('foo');
//Result
<!--foo-->
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.