wikimedia/idle-dom
IDLeDOM provides PHP interfaces and helper traits for the DOM as defined by Web IDL, enabling type-safe documents, nodes, and elements with interchangeable implementations. It helps libraries offer standards-compliant DOM behavior without binding to a single backend.
ext-dom (DOMDocument) is too lossy for HTML5 (implied tags, foster parenting, malformed markup recovery).Adopt when:
ext-dom is insufficient (fragment parsing, node-type fidelity, mutation semantics, serialization round-tripping).Look elsewhere when:
symfony/dom-crawler, masterminds/html5, or QueryPath-style tools are lower-ceremony and better documented.For executives: We are evaluating a small, MIT-licensed PHP library maintained by the Wikimedia Foundation — the interface layer that powers HTML processing behind Wikipedia via Parsoid. It is not a flashy dependency by GitHub metrics, because development happens on Wikimedia's Gerrit rather than GitHub, which makes standard "star and dependent" scoring misleading. The strategic value is that it gives us a specification-derived contract for HTML document manipulation, so we can build content-processing features on a stable foundation instead of a bespoke one, and swap the underlying implementation later without rewriting product code. The main risk is not technical quality but support posture: it is community/institution-maintained with no vendor SLA, so we should treat integration effort as ours and keep a fallback path.
For engineering: IDLeDOM provides WebIDL-generated PHP interfaces and traits mirroring the WHATWG DOM. It does not parse or serialize HTML — pair it with an implementation (Dodo) and a parser (RemexHtml), the same combination Parsoid uses in production. Expect to write adapter code, expect to read specs rather than blog posts, and expect contributions to go through Gerrit. In exchange you get strong typing over the DOM, HTML5-correct semantics that ext-dom does not reliably give us, and a contract stable enough that we can change implementations without touching feature code. Recommendation: spike one pipeline end-to-end (parse → mutate → serialize) before committing, and pin versions given the mirror release flow.
How can I help you explore Laravel packages today?