PHPackages                             html5/htmlreader - 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. html5/htmlreader

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

html5/htmlreader
================

Html5 stream tokenizer/reader (not using libxml)

v2.0.1(8y ago)13.3k11MITHTMLPHP &gt;=7.0

Since Aug 18Pushed 8y ago1 watchersCompare

[ Source](https://github.com/dermatthes/HTMLReader)[ Packagist](https://packagist.org/packages/html5/htmlreader)[ Docs](http://leuffen.de)[ RSS](/packages/html5-htmlreader/feed)WikiDiscussions master Synced 4w ago

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

[![Downloads this Month](https://camo.githubusercontent.com/63a99f516a0103e82b165c0932e9f01a1786db1d855e951152ad730df9e7ddda/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f68746d6c352f68746d6c7265616465722e737667)](https://packagist.org/packages/html5/htmlreader)[![](https://camo.githubusercontent.com/1ac5244f8d316120f8c7b44e51a58926334e5ae069a8a5e72ad92e82f94cdeb6/68747470733a2f2f7472617669732d63692e6f72672f6465726d6174746865732f48544d4c5265616465722e737667)](https://travis-ci.org/dermatthes/HTMLReader)[![Latest Stable Version](https://camo.githubusercontent.com/26771c1ba6d22f01422e63e9f8c5ddbb5de25efdf0688d099276341278f403c3/68747470733a2f2f706f7365722e707567782e6f72672f68746d6c352f68746d6c7265616465722f762f737461626c65)](https://github.com/dermatthes/HTMLReader/releases)

HTMLReader
==========

[](#htmlreader)

HtmlReader is a very simple Html Parser NOT build on libxml. It is thought as replacement for XMLReader which won't parse html5 input data properly. It is faster than DOM and won't change a single whitespace.

It won't care about properly closed Elements etc. so you can / have to do it your own.

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

[](#installation)

Use Composer to install the Package from Packagist.com:

```
composer require html5/htmlreader

```

Usage
-----

[](#usage)

```
$reader = new HtmlReader();
$reader->loadHtml("input.html")
// $reader->loadHtmlString("");

$reader->setHandler(new HtmlCallback()); // parse();
```

Debugging
---------

[](#debugging)

We have packed a DebugHtmlCallback Handler.

New in Version 1.1.0
--------------------

[](#new-in-version-110)

- Added Support for Namespaces

Credits
-------

[](#credits)

Written by Matthias Leuffen

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~150 days

Total

4

Last Release

3150d ago

Major Versions

1.1.0 → v2.0.02017-11-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/878a384d056698a2400e4b7c8858db05a6caebb2c560e67151be36d46d58def0?d=identicon)[dermatthes](/maintainers/dermatthes)

---

Top Contributors

[![dermatthes](https://avatars.githubusercontent.com/u/13380559?v=4)](https://github.com/dermatthes "dermatthes (15 commits)")

---

Tags

htmlHTML5tokenizerparsing

### Embed Badge

![Health badge](/badges/html5-htmlreader/health.svg)

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k260.4M294](/packages/masterminds-html5)[league/html-to-markdown

An HTML-to-markdown conversion helper for PHP

1.9k31.0M276](/packages/league-html-to-markdown)[yethee/tiktoken

PHP version of tiktoken

1623.7M28](/packages/yethee-tiktoken)[ressio/pharse

Fastest PHP HTML Parser

8582.2k](/packages/ressio-pharse)[oscarotero/html-parser

Parse html strings to DOMDocument

155.4M1](/packages/oscarotero-html-parser)[jbroadway/slimdown

A simple regex-based Markdown parser.

347.9k](/packages/jbroadway-slimdown)

PHPackages © 2026

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