PHPackages                             aduh95/html-generator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. aduh95/html-generator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

aduh95/html-generator
=====================

HTML generator in PHP, implementing most of the jQuery DOM manipulation API

1.0.0(9y ago)085MITPHP

Since Aug 14Pushed 8y ago1 watchersCompare

[ Source](https://github.com/aduh95/html-generator)[ Packagist](https://packagist.org/packages/aduh95/html-generator)[ RSS](/packages/aduh95-html-generator/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (2)Versions (5)Used By (0)

HTML Generator
==============

[](#html-generator)

This project aims to generate valid and XSS-safe HTML from friendly PHP commands. You can use some of the the [jQuery DOM manipulations](http://api.jquery.com/category/manipulation/) methods, because I missed some of them in PHP. The project is built on PHP's [DOM functions](http://php.net/manual/en/book.dom.php), though the performance are quite good. The goal is to improve readability (even for people who do not know PHP at all) and make it easier to detect and to avoid XSS. You won't need the `?>` closing tag anymore!

If you think this librairy lacks a feature or have some bad design, feel free to contribute or to raise an issue.

Installation
------------

[](#installation)

The easiest way: using [Composer](https://getcomposer.org)

```
composer require aduh95/html-generator
```

Then, you have to include Composer's autoload file at the begining of your scripts.

```

```

If you don't use Composer (and really you should!), you can use the PHAR archive you'll find in the Releases section.

```

```

You can also clone this repo and include the PHP classes which follow the [PSR-4](www.php-fig.org/psr/psr-4/).

Getting started
---------------

[](#getting-started)

I would recommend to subclass the `Document` class to include your usual html tags. As soon as I have time, I will put examples in the wiki.

Here is an overview of the main features:

```
