1. Go to this page and download the library: Download becklyn/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/ */
becklyn / html-builder example snippets
use Becklyn\HtmlBuilder\Builder\HtmlBuilder;
use Becklyn\HtmlBuilder\Node\HtmlElement;
$builder = new HtmlBuilder();
$link = new HtmlElement("a", [
"href" => "https://becklyn.com",
], [
"Becklyn Studios"
]);
assert('<a href="https://becklyn.com">Becklyn Studios</a>' === $builder->buildElement($link));
use Becklyn\HtmlBuilder\Builder\HtmlBuilder;
use Becklyn\HtmlBuilder\Node\HtmlAttributes;
$builder = new HtmlBuilder();
$attributes = $builder->buildAttributes(new HtmlAttributes([
"href" => "https://becklyn.com",
"target" => "_blank",
]));
echo "<a {$attributes}>Becklyn</a>";
$link = new HtmlElement("div");
$link->addContent(new SafeMarkup("This will <b>not</b> be escaped!"));
assert('<div>This will <b>not</b> be escaped!</div>' === $builder->buildElement($link));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.