PHPackages                             masterminds/html5 - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. masterminds/html5

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

masterminds/html5
=================

An HTML5 parser and serializer.

2.10.0(9mo ago)1.8k242.8M—6.7%120[29 issues](https://github.com/Masterminds/html5-php/issues)[7 PRs](https://github.com/Masterminds/html5-php/pulls)20MITHTMLPHP &gt;=5.3.0

Since Jun 1Pushed 2mo ago47 watchersCompare

[ Source](https://github.com/Masterminds/html5-php)[ Packagist](https://packagist.org/packages/masterminds/html5)[ Docs](http://masterminds.github.io/html5-php)[ RSS](/packages/masterminds-html5/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (41)Used By (20)

> # UKRAINE NEEDS YOUR HELP NOW!
>
> [](#ukraine-needs-your-help-now)
>
> On 24 February 2022, Russian [President Vladimir Putin ordered an invasion of Ukraine by Russian Armed Forces](https://www.bbc.com/news/world-europe-60504334).
>
> Your support is urgently needed.
>
> - Donate to the volunteers. Here is the volunteer fund helping the Ukrainian army to provide all the necessary equipment:  or
> - Triple-check social media sources. Russian disinformation is attempting to coverup and distort the reality in Ukraine.
> - Help Ukrainian refugees who are fleeing Russian attacks and shellings:
> - Put pressure on your political representatives to provide help to Ukraine.
> - Believe in the Ukrainian people, they will not surrender, they don't have another Ukraine.
>
> THANK YOU!

---

HTML5-PHP
=========

[](#html5-php)

HTML5 is a standards-compliant HTML5 parser and writer written entirely in PHP. It is stable and used in many production websites, and has well over [five million downloads](https://packagist.org/packages/masterminds/html5).

HTML5 provides the following features.

- An HTML5 serializer
- Support for PHP namespaces
- Composer support
- Event-based (SAX-like) parser
- A DOM tree builder
- Interoperability with [QueryPath](https://github.com/technosophos/querypath)
- Runs on **PHP** 5.3.0 or newer

[![CI](https://github.com/Masterminds/html5-php/actions/workflows/ci.yaml/badge.svg)](https://github.com/Masterminds/html5-php/actions/workflows/ci.yaml)[![Latest Stable Version](https://camo.githubusercontent.com/3fcab8a7e32f5a6025dd0ea011883dd6f1e59c8b5628daefbeb32c024b0ccd12/68747470733a2f2f706f7365722e707567782e6f72672f6d61737465726d696e64732f68746d6c352f762f737461626c652e706e67)](https://packagist.org/packages/masterminds/html5)[![Code Coverage](https://camo.githubusercontent.com/e1ff0899b155c6e3542dfb47a93245f50bedd31b117fa5a533b88bcadac94c13/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d61737465726d696e64732f68746d6c352d7068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Masterminds/html5-php/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/02e0b2c7db0899dfca2741717751d67c69a84628a03ad7f414c5d082916323a5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d61737465726d696e64732f68746d6c352d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Masterminds/html5-php/?branch=master)[![Stability: Sustained](https://camo.githubusercontent.com/f492e854876dc82ad0bd03ec97ab9718a8a2ad71b3be4f53552cf8a9f900f8e2/68747470733a2f2f6d61737465726d696e64732e6769746875622e696f2f73746162696c6974792f7375737461696e65642e737667)](https://masterminds.github.io/stability/sustained.html)

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

[](#installation)

Install HTML5-PHP using [composer](http://getcomposer.org/).

By adding the `masterminds/html5` dependency to your `composer.json` file:

```
{
  "require" : {
    "masterminds/html5": "^2.0"
  },
}
```

By invoking require command via composer executable:

```
composer require masterminds/html5
```

Basic Usage
-----------

[](#basic-usage)

HTML5-PHP has a high-level API and a low-level API.

Here is how you use the high-level `HTML5` library API:

```
