With developer experience in mind, XML Wrangler can read any kind of XML file, including those with intricate namespaces and enormous files. If the XML is erroneous, it will also raise exceptions!
A straightforward PHP library called XML Wrangler was created to make reading and writing XML simple. This package is framework agnostic and may be used in any PHP project (>=v8.1) using well-known Laravel-like techniques. With its abundance of functionality, XML Wrangler makes working with XML far more pleasurable than it is with PHP right out of the box.
- Dot Notation: XML document querying with dot-notation
- Low memory usage:Â Large XML files can be read by XML Wrangler.
- Laravel-like:Â methods that you can use likeÂ
sole
,Âfirst
,ÂfirstOrFail
,Âcollect
, etc. - Lazy methods:Â Read large XML files and repeatedly run a loop over each node
- XML Generation: Write XML using arrays
- XML Parsing: Provides functionality to parse XML documents.
- DTOs: Use theÂ
Element
 DTO element to define attributes and namespaces - Error Handling: It handles errors correctly, in contrast to SimpleXML.
- XPath Queries:Â supports data extraction from XML using XPath queries.
- Editing and Manipulation:Â permits XML data to be modified and handled.
- Simple API:Â provides an easy-to-use API for handling XML
- Namespace Support: Handles XML namespaces.
Here’s an example of reading XML, however you should read the readme to understand about all you can do with this package: