{"repo":"spatie/array-to-xml","free":true,"listed":false,"github":"https://github.com/spatie/array-to-xml","clone":"git clone https://github.com/spatie/array-to-xml.git","description":"A simple class to convert an array to xml","language":"PHP","stars":1198,"topics":["xml","configuration","array","api"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"Convert an array to xml This package provides a very simple class to convert an array to an xml string. Support us We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products. We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall. Install You can install this package via composer. Usage After running this piece of code $result will contain: Setting the name of the root element Optionally you can set the name of the rootElement by passing it as the second argument. If you don't specify this argument (or set it to an empty string) \"root\" will be used. Handling key names By default all spaces in the key names of your array will be converted to underscores. If you want to opt out of this behaviour you can set the third argument to false. We'll leave all keynames alone. Adding attributes You can use a key named attributes to add attributes to a node, and value to specify the value. This code will result in: Note, that the value of the value field must be a string. (More) Adding comments You can use a key named comment to add a comment to a node. The exact placement depends on where you put the key in your array. You can also add multiple keys starting with comment to add multiple comments. This code will result in: [!NOTE] A comment will be ","default_branch":null,"files":null,"tree":[],"storefront":"/r/spatie","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/spatie/array-to-xml/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}