sabre/xml
sabre/xml is a lightweight, specialized XML reader and writer for PHP. It makes it easy to parse XML into structured data and generate XML output with namespace support. Version 3 adds strict type declarations and supports PHP 7.4+ and PHP 8.
XmlServiceProvider) for reuse across modules.explode(), or fragile DOMDocument/SimpleXML code) and need a maintainable, tested alternative.sabre/vobject, sabre/event) or planning to adopt them in the future.SimpleXML (for lightweight parsing).xml_parser_create() (for minimalist needs).XMLReader/XMLWriter is preferred (this library adds abstraction overhead).composer.json rules or air-gapped environments).ext-xsl (for XSLT).xmlschema/xmlschema (for XSD validation).*"This is a strategic investment for any project handling XML as a core feature. Used in production by enterprise systems like SabreDAV (used by millions of users), it eliminates the technical debt and bug risk of custom XML parsing. Here’s why it’s a no-brainer for us:
DOMDocument.For projects where XML is a mission-critical component—whether for APIs, legacy integrations, or compliance—this is the safest, fastest path to success. The alternative is reinventing the wheel and paying the price later in bugs and maintenance."
*"sabre/xml is the Swiss Army knife for PHP XML processing—type-safe, namespace-aware, and production-ready. Here’s how it solves your pain points:
explode(), or brittle SimpleXML/DOMDocument hacks with a structured, maintainable approach.XmlWriter (e.g., for legacy clients).ParseInvoiceJob).XmlService for reuse across modules.preg_match() or DOMDocument loops with XmlReader/XmlWriter.Response::xml($data)).phpstan/extension-installer to integrate with PHPStan.@XmlElement("invoice") annotations).XmlReader instead of SimpleXML.explode()-based parsers to type-safe XmlReader logic.This isn’t just another XML library—it’s a force multiplier for teams tired of XML headaches. Let’s use it to ship faster, sleep better, and avoid production fires."
*"Here’s the TL;DR for implementation:
XmlReader: Parse XML into PHP arrays/objects (e.g., reader->parse($xml)How can I help you explore Laravel packages today?