PHPackages                             neochief/html5-dom-document-php - 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. neochief/html5-dom-document-php

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

neochief/html5-dom-document-php
===============================

HTML5 DOMDocument PHP library (extends DOMDocument)

v1.1.0(7y ago)0613↓66.7%MITPHPPHP &gt;=7.0.0

Since Mar 30Pushed 7y ago1 watchersCompare

[ Source](https://github.com/neochief/html5-dom-document-php)[ Packagist](https://packagist.org/packages/neochief/html5-dom-document-php)[ RSS](/packages/neochief-html5-dom-document-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (46)Used By (0)

HTML5DOMDocument
================

[](#html5domdocument)

HTML5DOMDocument extends the native [DOMDocument](http://php.net/manual/en/class.domdocument.php) library. It fixes some bugs and adds some new functionality.

[![Build Status](https://camo.githubusercontent.com/59cb237c43b523253d4a9608cbaf9711d0b31bbafa849eed9b1af7113e1582f8/68747470733a2f2f7472617669732d63692e6f72672f69766f7065746b6f762f68746d6c352d646f6d2d646f63756d656e742d7068702e737667)](https://travis-ci.org/ivopetkov/html5-dom-document-php)[![Latest Stable Version](https://camo.githubusercontent.com/0d12b11527d3c212a0dd9ec137c4abb78f8ae2b2f93abbe76f2b4daa608238ed/68747470733a2f2f706f7365722e707567782e6f72672f69766f7065746b6f762f68746d6c352d646f6d2d646f63756d656e742d7068702f762f737461626c65)](https://packagist.org/packages/ivopetkov/html5-dom-document-php)[![codecov.io](https://camo.githubusercontent.com/eb0a97d5b1891fa590141d2e4e7f05fc10b5cd1276635ab4edfc40a2187e4688/68747470733a2f2f636f6465636f762e696f2f6769746875622f69766f7065746b6f762f68746d6c352d646f6d2d646f63756d656e742d7068702f636f7665726167652e7376673f6272616e63683d6d6173746572)](https://codecov.io/github/ivopetkov/html5-dom-document-php?branch=master)[![License](https://camo.githubusercontent.com/56364e0da53b810e1239bc8640dfb121ffd384d244dffe76b1cb7c700afcc7dd/68747470733a2f2f706f7365722e707567782e6f72672f69766f7065746b6f762f68746d6c352d646f6d2d646f63756d656e742d7068702f6c6963656e7365)](https://packagist.org/packages/ivopetkov/html5-dom-document-php)[![Codacy Badge](https://camo.githubusercontent.com/7b5c428f9dab40d07c49c567a08058fc5281c559c1a908048bf6b87d58ecd8f1/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6461666135373232323838623430396139643434376661366161626435373262)](https://www.codacy.com/app/ivo_2/html5-dom-document-php)

Why use?
--------

[](#why-use)

- Preserves html entities (DOMDocument does not)
- Preserves void tags (DOMDocument does not)
- Allows **inserting HTML code** that moves the correct parts to their proper places (head elements are inserted in the head, body elements in the body)
- Allows **querying the DOM with CSS selectors** (currently available: \*, tagname, tagname#id, #id, tagname.classname, .classname, tagname.classname.classname2, .classname.classname2, tagname\[attribute-selector\], \[attribute-selector\], "div, p", div p, div &gt; p, div + p and p ~ ul.)
- Adds support for element-&gt;classList.
- Adds support for element-&gt;innerHTML.
- Adds support for element-&gt;outerHTML.

Install via Composer
--------------------

[](#install-via-composer)

```
composer require ivopetkov/html5-dom-document-php:1.*
```

Documentation
-------------

[](#documentation)

Full [documentation](https://github.com/ivopetkov/html5-dom-document-php/blob/master/docs/markdown/index.md) is available as part of this repository.

Examples
--------

[](#examples)

Use just like you should use DOMDocument:

```
