PHP and XML

PHP itself is covered in LAMP Stack Development; here are its XML extensions, all built on libxml2 3,427 (on Ubuntu 225 , sudo apt install php-xml provides them). These examples ran on PHP 8.5.4 in WSL 6 .

Subsections


PHP Integration

PHP's primary XML API is the DOM extension, built on libxml2 3,427 . This chapter covers PHP's DOM classes and their use for reading, writing, validating, querying (XPath), and transforming (XSLT) XML documents.

Other PHP extensions also handle XML: SimpleXML and XMLReader offer lighter-weight alternatives to DOM. For XQuery support in PHP, a third-party option is Zorba.

Subtopics: