DOM, HTML 5, and PHP

DOM, HTML 5, and PHP

Speaker(s)
nielsdos
Duration
Session track
Code & Development
Experience level
Intermediate
Description

Did you know that PHP has a native DOM API for parsing and manipulating HTML and XML documents?
It is remarkably powerful and serves as the foundation for a bunch of different PHP libraries. Think about scrapers, sanitizers, template engines, and more.
However, did you also know that this API did not support HTML 5 (living standard) prior to PHP 8.4?

In this session, we'll take a deep dive into the DOM manipulation and HTML parsing capabilities of PHP. We'll explore the practical implications of the lack of HTML 5 support in earlier versions, and how that affects data integrity and security. Furthermore, we also highlight some of its shortcomings prior to PHP 8.4, shedding light on the challenges and frustrations developers faced over the years. Finally, we also talk about new API additions like native querySelector support.

An introduction to the topic was previously given in November 2023 at betterCode PHP. Since then, many developments inside PHP have taken place. Therefore, this session is only loosely based on that. This session furthermore adds information about the new features added in DOM in PHP 8.4.