1. Go to this page and download the library: Download artyuum/html-element 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/ */
artyuum / html-element example snippets
use Artyum\HtmlElement\Element;
use Artyum\HtmlElement\Attribute;
$divElement = new Element('div');
$divElement
->addAttributes(
new Attribute('title', 'This is an editable DIV with a red background color'),
new Attribute('style', [
'width: 100px',
'height: 100px',
'background-color: red'
]),
new Attribute('contenteditable', true)
)
->addContent('This is an editable DIV with a red background color.')
;
echo $divElement;
// or
echo $divElement->toHtml();
use Artyum\HtmlElement\Element;
use Artyum\HtmlElement\Attribute;
$formElement = new Element('form');
$divElement = new Element('div');
$labelElement = new Element('label');
$usernameInputElement = new Element('input');
$passwordInputElement = new Element('input');
$buttonElement = new Element('button');
$spanElement = new Element('span');
$formElement
->addAttributes(
new Attribute('action', '/login'),
new Attribute('method', 'post')
)
->addContent(
$divElement
->addAttributes(new Attribute('class', 'form-group'))
->addContent(
$labelElement
->addAttributes(new Attribute('for', 'username'))
->addContent('Username'),
$usernameInputElement
->addAttributes(
new Attribute('type', 'text'),
new Attribute('class', 'form-control'),
new Attribute('id', 'username'),
new Attribute('name', 'username'),
new Attribute('placeholder', 'Username'),
new Attribute('style', [
'border: none',
'background-color: rgba(100, 100, 255, .1)'
]),
new Attribute('