Level 1
You can use this https://github.com/SoapBox/laravel-formatter
1 like
Hi Laracasters, I'm looking to convert my array's to XML for google products XML feeds.
I'm tried a few packages but nothing is really useful. I'm unsure if just writing a forloop with xml elements, but this to me sounds silly as I'm sure there is someway to convert it simply in Laravel (Lumen).
Tanks in advance.
I ended up just using a view that had a forloop around the data. Used a response in the controller that told the view what content-type it needed and it outputted correctly so no need for a package.
But ill take a look at it now anywhos.
$products = Product::all();
$content = view('product.xml', compact('products'));
return response($content, 200)
->header('Content-Type', 'text/xml');
Please or to participate in this conversation.