Return CSV from an API route that uses Spatie Query Builder package
I'm looking for some initial guidance/help, basically ideas on how to approach my task.
I'm using the Spatie Laravel Query Builder package for my apps API. So, I can filter Models etc. (https://github.com/spatie/laravel-query-builder)
Returning JSON is great, but I'd also like to return CSV files.
What recommendations do people have for grabbing the Query result and converting to CSV.
And an extra question: I'm working with 10million+ records, so some of the results will need to be chunked and streamed responses (Symfony\Component\HttpFoundation\StreamedResponse)
Any suggestions would be great!!
Please or to participate in this conversation.