1. Go to this page and download the library: Download effectra/html-render 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/ */
effectra / html-render example snippets
use Effectra\HtmlRender\HtmlElement;
// Create an HTML element with a <div> tag and some content
$element = new HtmlElement('This is a div element', 'div');
// Get the content of the HTML element
$content = $element->getContent();
echo $content; // Output: This is a div element
// Get the tag name of the HTML element
$tag = $element->getTag();
echo $tag; // Output: div
// Get all attributes of the HTML element
$attributes = $element->getAttributes();
print_r($attributes); // Output: []
// Set the content of the HTML element and create a new instance
$newElement = $element->withContent('New content');
use Effectra\HtmlRender\Render;
// Generate the HTML <html> tag
$htmlTag = Render::tagHtml('Content', 'en');
// Generate the HTML <head> tag
$headTag = Render::tagHead('Head content');
// Generate the HTML <body> tag
$bodyTag = Render::tagBody('Body content');
// Generate the HTML <title> tag
$titleTag = Render::tagTitle('Page Title');
use Effectra\HtmlRender\Factory\HtmlElementFactory;
$factory = new HtmlElementFactory();
// Create an HTML element using the factory
$element = $factory->createHtmlElement('Element content', 'span', ['class' => 'highlight']);
// Get the content of the created element
$content = $element->getContent();
echo $content; // Output: Element content
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.