zendframework/zend-xml2json
Converts XML to JSON using PHP's DOM and JSON extensions, letting you transform XML documents or strings into JSON output ready for APIs, storage, or JavaScript consumption.
DOMDocument with an Xml2Json::fromXml($xml, $ignoreExceptions) entry point returning a JsonSerializable. A competent engineer replicates the useful 80% in well under a day. That materially changes the calculus: the cost of not using it is low, and the cost of owning an archived dependency can exceed it.laminas/laminas-xml2json (the official successor) or native DOM, and do not add zendframework/* to new work."Consider it only when all of the following hold:
zendframework/* components and need behavioral parity with code that already ships — a stopgap, not a greenfield choice.Look elsewhere when any of the following is true:
SimpleXML/DOMDocument plus json_encode, or laminas/laminas-xml2json for API-compatible behavior with an active maintainer.sabre/xml or hand-written mapping — a generic converter turns schema ambiguity into silent data corruption.XMLReader (pull-based) is the correct tool; DOM will OOM before it finishes.To executives: Recommend against adopting this library. It is free and BSD-licensed, but it has been archived upstream since 2019, has negligible community adoption (15 stars, low health score), and receives no security patches. The financial exposure isn't license cost — it's supply-chain risk and the engineering time to rip it out later under pressure. The migration path to the maintained successor is a Composer swap plus a namespace change, so the cost of choosing correctly now is near zero.
To engineering: It's a ~1-class wrapper around DOMDocument exposing Xml2Json::fromXml(). No Laravel integration whatsoever — you'd wire it yourself. The successor project is laminas/laminas-xml2json (same API lineage, active maintenance); migrating is roughly a one-to-two-day task dominated by test updates, not code changes. If a legacy service already depends on it, contain it: pin the version, isolate it behind an internal XmlToArrayConverter interface, and add a golden-file test suite so the eventual swap is a dependency-injection change rather than a refactor.
Recommendation: Do not adopt for new work. Permit only as a documented, time-boxed exception inside existing Zend Framework code, with an owner and a dated removal ticket. Default new XML-ingestion work to native DOM/SimpleXML or laminas/laminas-xml2json.
How can I help you explore Laravel packages today?