Skip to content

Instantly share code, notes, and snippets.

View johnny-bit's full-sized avatar
🏚️
Working from home

Hubert Kowalski johnny-bit

🏚️
Working from home
View GitHub Profile
@alexmnv
alexmnv / Silex - Symfony - output CSV as stream
Last active October 3, 2019 08:12
Silex/Symfony - output CSV
function outputCSV(Application $app, array $recs, $filename)
{
$stream = function() use ($recs) {
$output = fopen('php://output', 'w');
foreach ($recs as $rec)
{
fputcsv($output, $rec);
}
fclose($output);
};