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

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

innmind/html
============

Library to abstract html manipulation

8.0.0(3mo ago)113.4k↓48.9%[1 issues](https://github.com/Innmind/Html/issues)5MITHTMLPHP ~8.4CI passing

Since Oct 30Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/Innmind/Html)[ Packagist](https://packagist.org/packages/innmind/html)[ Docs](http://github.com/Innmind/Html)[ RSS](/packages/innmind-html/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (6)Dependencies (8)Versions (22)Used By (5)

HTML
====

[](#html)

[![Build Status](https://github.com/innmind/html/workflows/CI/badge.svg?branch=master)](https://github.com/innmind/html/actions?query=workflow%3ACI)[![codecov](https://camo.githubusercontent.com/ed724c6ec877767429c9457f1844dd32a5bc4ed68a4ea0ed73ff96ea623be88a/68747470733a2f2f636f6465636f762e696f2f67682f696e6e6d696e642f68746d6c2f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/innmind/html)[![Type Coverage](https://camo.githubusercontent.com/e62fdf914dab91e68e989fb166bf7e95bd16d20e321cc569cdfa41402d5d9f1c/68747470733a2f2f73686570686572642e6465762f6769746875622f696e6e6d696e642f68746d6c2f636f7665726167652e737667)](https://shepherd.dev/github/innmind/html)

This library is an extension of [`innmind/xml`](https://packagist.org/packages/innmind/xml) to support working properly with html as a node tree.

**Important**: you must use [`vimeo/psalm`](https://packagist.org/packages/vimeo/psalm) to make sure you use this library correctly.

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

[](#installation)

```
composer require innmind/html
```

Usage
-----

[](#usage)

```
use Innmind\Html\{
    Reader,
    Document,
};
use Innmind\Xml\{
    Node,
    Element,
    Element\Custom,
};
use Innmind\Filesystem\File\Content;
use Innmind\Immutable\Maybe;

$read = Reader::new();

$html = $read(
    Content::ofString(\file_get_contents('https://github.com/')),
); // Maybe
```

Extract some elements of the tree
---------------------------------

[](#extract-some-elements-of-the-tree)

This library provides some visitors to extract elements out of the dom tree, the example below show you how to extract all the `h1` elements of a tree:

```
use Innmind\Html\Visitor\Elements;

$h1s = Elements::of('h1')($html);
```

Here `$h1s` is a sequence of `Element` which are all `h1` elements.

Here's the full list of visitors you have access to:

- [`Element`](src/Visitor/Element.php)
- [`Elements`](src/Visitor/Elements.php)

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance58

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

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

Recently: every ~204 days

Total

18

Last Release

113d ago

Major Versions

3.2.0 → 4.0.02019-01-05

4.1.0 → 5.0.02020-01-27

5.1.0 → 6.0.02022-04-24

6.4.0 → 7.0.02025-06-07

7.0.0 → 8.0.02026-01-25

PHP version history (8 changes)1.0.0PHP ~7.0

2.0.0PHP ~7.1

3.1.0PHP ~7.2

5.0.0PHP ~7.4

5.1.0PHP ~7.4|~8.0

6.0.0PHP ~8.1

6.2.0PHP ~8.2

8.0.0PHP ~8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/851425?v=4)[Baptiste Langlade](/maintainers/Baptouuuu)[@Baptouuuu](https://github.com/Baptouuuu)

---

Top Contributors

[![Baptouuuu](https://avatars.githubusercontent.com/u/851425?v=4)](https://github.com/Baptouuuu "Baptouuuu (150 commits)")

---

Tags

html

### Embed Badge

![Health badge](/badges/innmind-html/health.svg)

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

###  Alternatives

[spatie/laravel-html

A fluent html builder

8376.4M72](/packages/spatie-laravel-html)[ckeditor/ckeditor

JavaScript WYSIWYG web text editor.

5234.2M76](/packages/ckeditor-ckeditor)[caxy/php-htmldiff

A library for comparing two HTML files/snippets and highlighting the differences using simple HTML.

21320.9M15](/packages/caxy-php-htmldiff)[yajra/laravel-datatables-html

Laravel DataTables HTML builder plugin

2899.6M48](/packages/yajra-laravel-datatables-html)[wa72/htmlpagedom

jQuery-inspired DOM manipulation extension for Symfony's Crawler

3383.9M34](/packages/wa72-htmlpagedom)[tinymce/tinymce

Web based JavaScript HTML WYSIWYG editor control.

1697.5M106](/packages/tinymce-tinymce)

PHPackages © 2026

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