PHP code example of krzysztofzylka / html-generator
1. Go to this page and download the library: Download krzysztofzylka/html-generator 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/ */
krzysztofzylka / html-generator example snippets
echo \Krzysztofzylka\HtmlGenerator\HtmlGenerator::createTag('div')
echo \Krzysztofzylka\HtmlGenerator\HtmlGenerator::createTag(
'div',
'content'
)
echo \Krzysztofzylka\HtmlGenerator\HtmlGenerator::createTag(
'div',
'content',
'classes'
)
echo \Krzysztofzylka\HtmlGenerator\HtmlGenerator::createTag(
'div',
'content',
'classes',
['attributes' => 'value']
)
echo new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div');
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div'))
->setContent('content')
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div'))
->getContent()
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div'))
->appendContent('append content')
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div'))
->addAttributes(['id' => 'div-id', 'class' => 'classes'])
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div'))
->addAttribute('id', 'div-id')
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div'))
->getAttribute('id')
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div'))
->appendAttribute('class', 'next_class')
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div'))
->removeAttribute('class')
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div'))
->setId('div-id')
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('input'))
->setName('input-name')
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div'))
->setClass('class')