mf/csv-exporter

CSV Exporter

4.0.0 2022-09-21 16:05 UTC

This package is auto-updated.

Last update: 2024-12-21 21:20:16 UTC


README

Latest Stable Version Total Downloads License Tests and linting Coverage Status

Csv exporter for Symfony

Installation

$ composer require mf/csv-exporter

Requirements

Usage

For detail explanation see this issue

In Symfony Controller action

return (new StreamedResponseFactory(/* ...dependencies */)) // from ->get('service')
    ->createCsv(
        'filename.csv',
        [
            'columns...',
        ],
        function ($offset, $bulk) use ($repository) {
            return $repository->findBulkForExport($offset, $bulk);
        },
        function (array $row) {
            return [
                $row['key'],
            ];
        }
    );