It should be noted CsvResponse extends StreamedResponse and uses goodby/csv library. The use of this response is relatively simple.
<?
use Symfony\Component\HttpFoundation\CsvResponse;
$data = array(
array('John Smith', '[email protected]'),
array('Jane Smith', '[email protected]')
);
new CsvResponse($data);
For further use please see goodby/csv