How to pass XML file to array in Laravel

0

I'm doing a laravel application with which you can upload an xml file to the server to insert your data in the database.

The problem with this is that I have uploaded the file but I can not convert it to an array to manage its data from laravel, I have tried several libraries but without success. Can anyone think of something with what I could do?

I've tried nathanmac / Parser and orchestra / parser libraries

    
asked by yondaine 29.03.2018 в 18:19
source

1 answer

1

It would be enough with the SimpleXML extension, it usually comes in the PHP installations, in the end it would be something like:

$xmlDocument = new SimpleXMLElement($xmlString);

And from that document you can start asking for the nodes they have, go through them, get their attributes and values.

See this official manual on the use of this extension:

link

    
answered by 31.03.2018 в 00:52