PHPackages                             bluiceoficial/miphanttpl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. bluiceoficial/miphanttpl

ActiveLibrary[Templating &amp; Views](/categories/templating)

bluiceoficial/miphanttpl
========================

Gera HTML de forma dinâmica com PHP.

4.0.0(1w ago)11↓100%MITPHP

Since Oct 28Pushed 1w agoCompare

[ Source](https://github.com/bluiceoficial/miphanttpl)[ Packagist](https://packagist.org/packages/bluiceoficial/miphanttpl)[ RSS](/packages/bluiceoficial-miphanttpl/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

MiPhantTPL
==========

[](#miphanttpl)

**MiPhantTPL** é uma biblioteca PHP **leve, extensível e minimalista** para geração de HTML através de **métodos dinâmicos**, permitindo escrever HTML de forma **programática, fluente e sem templates externos**.

Cada método chamado representa uma **tag HTML**, funcionando como uma **DSL (Domain Specific Language)** para HTML em PHP.

---

✨ Características
-----------------

[](#-características)

- Geração dinâmica de HTML via `__call`
- Cada método representa uma *tag HTML*
- Suporte automático a:
    - Tags que não possuem fechamento (`img`, `br`, `input`, entre outros)
    - Atributos booleanos (`checked`, `disabled`, `required`, entre outros)
- Possibilidade de **estender tags auto-fecháveis**
- Possibilidade de **estender atributos sem valor**
- Paradigma funcional
- Zero dependências
- Código pequeno, previsível e fácil de integrar

---

📦 Instalação
------------

[](#-instalação)

### Via Composer

[](#via-composer)

```
composer require bluiceoficial/miphanttpl
```

### Manual

[](#manual)

Copie o arquivo `MiPhantTPL.php` para seu projeto e inclua via autoload ou `require`.

---

🚀 Uso básico
------------

[](#-uso-básico)

```
use MiPhantTPL\MiPhantTPL;

$tpl = new MiPhantTPL();

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

Resultado:

```
Olá mundo
```

---

🧱 Criando elementos HTML
------------------------

[](#-criando-elementos-html)

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

```
Título
Conteúdo do parágrafo
```

---

🏷️ Atributos HTML
-----------------

[](#️-atributos-html)

Os atributos são passados como **array**:

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

```
Acessar site
```

---

✅ Atributos sem valor (booleanos)
---------------------------------

[](#-atributos-sem-valor-booleanos)

A biblioteca reconhece automaticamente atributos booleanos:

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

```

```

---

➕ Adicionando novos atributos sem valor
---------------------------------------

[](#-adicionando-novos-atributos-sem-valor)

Você pode estender a lista padrão de atributos booleanos:

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

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

```
Conteúdo
```

---

🔁 Tags que não possuem fechamento
---------------------------------

[](#-tags-que-não-possuem-fechamento)

Tags como `img`, `br`, `input` e similares não recebem fechamento automaticamente:

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

```

```

---

➕ Adicionando novas tags sem fechamento
---------------------------------------

[](#-adicionando-novas-tags-sem-fechamento)

Caso você utilize elementos personalizados (ex: Web Components):

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

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

```

```

---

🧩 HTML aninhado
---------------

[](#-html-aninhado)

Como tudo retorna `string`, é possível aninhar facilmente:

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

---

⚙️ Uso com paradigma funcional (`code()`)
-----------------------------------------

[](#️-uso-com-paradigma-funcional-code)

O método `code()` permite escrever HTML de forma estruturada:

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

---

📄 Doctype HTML5
---------------

[](#-doctype-html5)

```
echo $tpl->doctype();
```

```
>
```

---

👤 Autor
-------

[](#-autor)

**Murilo Gomes Julio**

🔗

📺

---

📜 Licença
---------

[](#-licença)

Copyright (c) 2025-2026 Murilo Gomes Julio

Licensed under the [MIT](https://github.com/bluiceoficial/miphanttpl/blob/main/LICENSE).

All contributions to the MiPhantTPL are subject to this license.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance98

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~71 days

Total

4

Last Release

12d ago

Major Versions

1.0.0 → 2.0.02025-11-17

2.0.0 → 3.0.02026-01-10

3.0.0 → 4.0.02026-05-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/e782d9d31b820ca2583dce523269edf91ef2db0d5c48af08384fad35324643cd?d=identicon)[mugomesoficial](/maintainers/mugomesoficial)

---

Top Contributors

[![bluiceoficial](https://avatars.githubusercontent.com/u/214032302?v=4)](https://github.com/bluiceoficial "bluiceoficial (11 commits)")

---

Tags

htmlphptemplate

### Embed Badge

![Health badge](/badges/bluiceoficial-miphanttpl/health.svg)

```
[![Health](https://phpackages.com/badges/bluiceoficial-miphanttpl/health.svg)](https://phpackages.com/packages/bluiceoficial-miphanttpl)
```

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3861.2M](/packages/limenius-react-bundle)[wmde/php-vuejs-templating

PHP implementation of Vue.js templating engine

3041.6k2](/packages/wmde-php-vuejs-templating)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.2k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

291.8k](/packages/webkinder-sproutset)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
