PHP code example of bluiceoficial / miphanttpl

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

    

bluiceoficial / miphanttpl example snippets


use MiPhantTPL\MiPhantTPL;

$tpl = new MiPhantTPL();

echo $tpl->p('Olá mundo');

echo $tpl->h1('Título');
echo $tpl->p('Conteúdo do parágrafo');

echo $tpl->a(
    'Acessar site',
    ['href' => 'https://example.com', 'target' => '_blank']
);

echo $tpl->input([
    'type' => 'checkbox',
    'checked'
]);

$tpl->addAttributeNoValue(['inert', 'itemscope']);

echo $tpl->div(
    'Conteúdo',
    ['inert']
);

echo $tpl->img([
    'src' => 'foto.jpg',
    'alt' => 'Imagem'
]);

$tpl->addNotClose(['mycomponent']);

echo $tpl->mycomponent([
    'data-id' => '123'
]);

echo $tpl->div(
    $tpl->h2('Título') .
    $tpl->p('Texto do conteúdo'),
    ['class' => 'container']
);

echo $tpl->code(function ($html) {
    return
        $html->doctype() .
        $html->html(
            $html->body(
                $html->h1('MiPhantTPL') .
                $html->p('Gerando HTML com PHP puro')
            )
        );
});

echo $tpl->doctype();