-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
A35G edited this page Sep 10, 2026
·
2 revisions
Welcome to the wiki for a35g/json-to-xml, a PHP library for converting JSON to XML and back, with support for attributes, automatic CDATA, and mixed content.
The library provides two independent classes:
| Class | Direction | Purpose |
|---|---|---|
JsonToXmlConverter |
JSON → XML | Generates an XML document from a JSON string |
XmlToJsonConverter |
XML → JSON | Generates a PHP array / JSON string from an XML document |
Both share the same conventions for representing attributes, mixed text, and lists, so you can (almost) go back and forth between the two formats predictably.
- PHP 8.1 or higher
-
domandjsonextensions (almost always available by default)
composer require a35g/json-to-xml- Home (this page) — overview and installation
- Basic-Usage — first examples: JSON → XML and XML → JSON
- Conventions — attributes, mixed text, lists, automatic CDATA
- Round-Trip-and-Limitations — why XML → JSON is not a perfect inverse
- Security-and-Error-Handling — XXE protection, exceptions, tag sanitization
- Checklist-and-Further-Reading — quick recap and references
➡️ Next page: Basic-Usage