Skip to content
Advertisement

PHP XML serializer

Is there some php libraries which implement serialization of data to XML-format like serialize() and unserialize() (with restoring objects from XML) functions of objects with private and protected fields?

PEAR XML_Serializer works fine with type hints option, but it doen’t deal with protected fields.

Advertisement

Answer

Hoping this is not considered spamming, but I’ve been working on a library that deals with serializing and deserialing objects from and to XML.

https://github.com/evert/sabre-xml/

However, it doesn’t do exactly what you’re asking. Every object you want to serialize needs to implement a serializeXML and deserializeXML method. In this method you can decide exactly what you need to implement.

If you do plan to use this, I would actually be happy to include the exact feature you want as a PHP 5.4 trait. Just send me a message (you can find my info on github).

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement