NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #4754 most downloaded on Packagist
HTML5 DOMDocument PHP library (extends DOMDocument)
Latest stable
v2.11.0
Last release 5 months ago
21 Jun 2026
Ships fairly regularly
a new release about every 5 months
Most releases are documented
notes for 44 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
72 releases · first in 2016
Drag across the ruler to compare, or tap a release to open it.
Add FIX_DUPLICATE_LINKS option to modify().
New:
Fix for libxml v2.15 (and maybe v2.14).
Fix:
New: - Add PHP 8.5 support.
New:
Your coding agent can read these notes before it upgrades. Set up the MCP server →
New: - Allow parsing huge documents.
New:
Fixed: - Fix when invalid HTML.
Fixed:
Add PHP 8.4 support. Remove PHP 7.* support.
New:
Add support for empty attributes in querySelector() and querySelectorAll().
New:
Thanks to chrishow for the contribution.
New: - Add support for PHP 8.3.
New:
Add FIX_DUPLICATE_STYLES option to modify() to remove duplicate tags.
New:
New: - Add PHP 8.2 support.
New:
Improve autocomplete of the elements returned by createElement(), createElementNS() and getElementById().
Enhancements:
Thanks to manychois for the contribution.
New: - Add support for PHP 8.1.
New:
Fix PHP versions in composer.json.
Fix PHP versions in composer.json.
Fix when modifying elements and there are duplicate IDs in the document.
Fix when modifying elements and there are duplicate IDs in the document.
Thanks to Christoph Möke for reporting this bug.
The library now works the same way as DomDocument when loadHTML() is not called before saveHTML().
The library now works the same way as DomDocument when loadHTML() is not called before saveHTML().
Thanks to Lewin Probst for pointing this inconsistency.
Fix conflicting internal string (breaks matching the html tag)
Fix conflicting internal string (breaks matching the html tag)
Big thanks to David Hayes for pointing out the bug and providing a fix.
Better exception message when duplicate element ids.
Better exception message when duplicate element ids.
Names (tagnames and attributes) are now case insensitive.
Query selectors fix:
Nothing published for this version
Nothing published for this version
Performance optimizations in query selectors.
Performance optimizations in query selectors.
Added HTML5DOMElement::getNodeValue() and HTML5DOMElement::getTextContent() that fix an issue with entities in the corresponding properties. Thanks to
Added HTML5DOMElement::getNodeValue() and HTML5DOMElement::getTextContent() that fix an issue with entities in the corresponding properties. Thanks to MrMadClown for the contribution.
Better handling script tags content (temporary added CDATA).
Better handling script tags content (temporary added CDATA).
Nothing published for this version
Fixed return values in several docblocks.
Fixed return values in several docblocks.
Thanks to BrunoDeBarros for the contribution.
Nothing published for this version
A new major release that better matches the behavior of the native DomDocument related to HTML elements with matching id attributes. DomDocument::load
A new major release that better matches the behavior of the native DomDocument related to HTML elements with matching id attributes. DomDocument::loadHTML() throws a warning when loading such HTML code. HTML5DOMDocument::loadHTML() now throws an exception it this case, that can be disabled when providing the HTML5DOMDocument::ALLOW_DUPLICATE_IDS option.
REMOVED:
ADDED:
FIXED
Big thanks to ygoe and manychois for their feedback and support.
Added support for complex selectors ("div, p", div p, div > p, div + p, p ~ ul). Internal optimizations.
Added support for complex selectors ("div, p", div p, div > p, div + p, p ~ ul). Internal optimizations.
Fix when using unsupported libxml constants.
Fix when using unsupported libxml constants.
Added support for '.class1.class2' selector.
Added support for '.class1.class2' selector.
Nothing published for this version
After 2+ years of active development and running on production environments, I'm proud to release v1.0.0 of the library. With the help of some awesome
After 2+ years of active development and running on production environments, I'm proud to release v1.0.0 of the library. With the help of some awesome folks we've managed to create the best library (in my opinion) to parse and manipulate HTML5 documents in PHP. Thank you for the support.
Changes from the previous stable version (0.6.*):
Removed PSR autoloader from composer.json.
Removed PSR autoloader from composer.json.
Added DOMElement::$classList property.
Added DOMElement::$classList property.
Thanks to manychois for the contributions.
Added support for multiple attributes selectors (tagname[attr1][attr2], etc.). Added support for attr~="value", attr|="value", attr^="value", attr$="v
Added support for multiple attributes selectors (tagname[attr1][attr2], etc.). Added support for attr~="value", attr|="value", attr^="value", attr$="value", attr*="value" query selectors. Fix in saveHTML() related to wrong charset values provided. Added ext-dom requirement in composer.json.
Thanks to Lee Willis for the contributions.
Added support for custom tags (dashes in the name) in querySelector() and querySelectorAll().
Added support for custom tags (dashes in the name) in querySelector() and querySelectorAll().
Thanks to bkonetzny for the contributions.
Added support for tagname[attribute] and [attribute] selectors.
Added support for tagname[attribute] and [attribute] selectors.
Thanks to WilliamStam for the contribution.
Performance optimizations. Fixed docblocks.
Performance optimizations. Fixed docblocks.
Thanks to mikemand for the contributions.
Nothing published for this version
Added insertHTMLMulti() method.
Added insertHTMLMulti() method.
Nothing published for this version
Fixes in preserving whitespace. Fixes in duplicate IDs removal. Performance optimizations.
Fixes in preserving whitespace. Fixes in duplicate IDs removal. Performance optimizations.
Nothing published for this version
Nothing published for this version
The library now supports PHP 7+ only. Performance optimizations.
The library now supports PHP 7+ only. Performance optimizations.
Added head elements order update.
Added head elements order update.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Duplicate IDs removal bug fix.
Duplicate IDs removal bug fix.
Duplicate IDs removal bug fix.
Duplicate IDs removal bug fix.
Nothing published for this version
Performance optimizations for innerHTML and outerHTML.
Performance optimizations for innerHTML and outerHTML.
Added support for [attribute="value"] and tagname[attribute="value"] selectors.
Added support for [attribute="value"] and tagname[attribute="value"] selectors.
Added a fix for inserting empty HTML in an insert target.
Added a fix for inserting empty HTML in an insert target.
Nothing published for this version
Performance optimizations. Fix in querySelector().
Performance optimizations. Fix in querySelector().
Nothing published for this version
Added querySelector() and querySelectorAll() for the document elements (Contributed by tcak). Performance optimizations.
Added querySelector() and querySelectorAll() for the document elements (Contributed by tcak). Performance optimizations.
One column per quarter.