ivopetkov/html5-dom-document-php
A PHP HTML5 DOMDocument library that parses and serializes modern HTML5 reliably while working around native DOMDocument limitations. It adds support for HTML5 tags and CSS selectors, making it easy to load, query, and manipulate documents with clean, familiar APIs.
DOMDocument uses an HTML4-era parser; it mangles or drops modern markup (<article>, <section>, <picture>, <template>, custom elements). The real decision is: patch around native behavior, adopt this MIT package, or stand up a headless-browser service. This package is the cheap middle path and lets you defer the heavier decision.Framing note for planning: opportunity score (2.53) is modest, so treat this as a utility-level dependency that de-risks adjacent features, not as a differentiator to build a roadmap around.
Adopt it when:
DOMDocument/DOMDocument::loadHTML is producing dropped content, broken nesting, or inconsistent trees in production.symfony/css-selector for querying without adopting a full browser stack.Look elsewhere when:
DOMDocument and your expected page volumes before committing; parsing cost matters at scale.For executives: This is a small, MIT-licensed PHP library that makes HTML parsing reliable for our content-import and user-content features. It carries no license cost and no vendor lock-in, and it removes a class of "content got dropped or corrupted" bugs that are expensive to diagnose after the fact. Recommendation: adopt as an internal utility dependency behind our own abstraction, so it stays swappable and doesn't become a single point of failure.
For engineering: A spec-oriented HTML5 parser that fixes the known shortcomings of PHP's native DOMDocument on modern markup. Composer-installable, integrates cleanly with Laravel and symfony/css-selector, released recently (2026-06-21) under MIT. Wrap it in an internal HtmlParser interface so we can benchmark and replace it if performance or maintenance becomes a concern.
For product and design partners: It unlocks import/ingest and UGC features sooner and with fewer edge-case failures, but it is not user-visible — don't position it as a feature.
Risk framing: Small project, ~600 stars, limited maintainer depth. Mitigate with an internal wrapper, pinned version, and a smoke-test suite over representative real-world HTML samples. Low cost, low lock-in, contained risk.
How can I help you explore Laravel packages today?