1. Go to this page and download the library: Download biggy905/php-generate-tags 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/ */
biggy905 / php-generate-tags example snippets
use GenerateTags\Tag;
use GenerateTags\TagRenderable;
$tag = new Tag('div');
$render = (new TagRenderable())
->addTag($tag)
->addContent('Hello world!')
->render();
echo $render;
/*
Output:
<div>Hello world!</div>
*/
$tag = new Tag('div');
$render = (new TagRenderable())
->addTag($tag)
->addContent('Best PHP')
->addAttributes(
[
'class' => 'container',
'data-custom' => 'data',
]
)
->render();
echo $render;
/*
Output:
<div class="container" data-custom="data">Best PHP</div>
*/