PHPackages                             esayers/html - 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. esayers/html

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

esayers/html
============

Generate HTML through PHP

10PHP

Since Aug 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/es-sayers/html)[ Packagist](https://packagist.org/packages/esayers/html)[ RSS](/packages/esayers-html/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

html
====

[](#html)

Generate HTML with PHP

Usage
-----

[](#usage)

Basic example

```
echo Html::div(
    Html::p('Example Text', ['class' => 'stylish'])
);
```

Output:

```
Example Text
```

`Html`
------

[](#html-1)

Create HTML tags using the static Html class.

```
echo Html::p('Paragraph text');
```

Output:

```
Paragraph text
```

Nesting tags

```
echo Html::div(
   Html::section([
           Html::h2('Heading'),
           Html::p('Amazing paragraph')
       ]
   )
);
```

Output:

```
Headingparagraph
```

Adding attributes

```
echo Html::div()
   ->id("2")
   ->class(['class1', 'class2']);
```

Output:

```

```

Tag-specific attributes:

```
echo Html::input()
       ->type("checkbox")
       ->checked(true);
```

Output:

```

```

Content automatically encoded
-----------------------------

[](#content-automatically-encoded)

```
echo Html::div('>
