PHP code example of jjgrainger / html
1. Go to this page and download the library: Download jjgrainger/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/ */
jjgrainger / html example snippets
use HTML\Element;
// Creat a link element.
$link = new Element('a');
// Set the href attribute.
$link->setAttribute('href', 'https://google.com');
// Set the class attribute.
$link->setAttribute('class', 'text-link');
// Append attribute values, in this case adding a 'active' class to the element.
$link->appendAttribute('class', 'active');
// Set the content for the
$link->setContent('Hello World!');
// Outputs HTML
echo $link;