PHP code example of fischimglas / ptag

1. Go to this page and download the library: Download fischimglas/ptag 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/ */

    

fischimglas / ptag example snippets

 
use PTag\HtmlFactory;

echo HtmlFactory::div()
    ->addClass('first-class')
    ->setAttribute('tabindex', 1)
    ->setAttribute('uk-img')
    ->setStyle('background','red')
    ->add(HtmlFactory::a(['href' => '#'], 'Link'))
    ->add(HtmlFactory::img(['src' => 'image.png']));
 
 
use PTag\HtmlFactory;

echo HtmlFactory::empty()
    ->add('Some content')
    ->addClass('notshown');
 
 
use PTag\HtmlFactory;
use PTag\ElementCf;

ElementCf::setMode(ElementCf::MODE_XHML);

echo HtmlFactory::div()
    ->add(HtmlFactory::img(['src' => 'image.png']));