mf / csv-exporter
CSV Exporter
Installs: 3 706
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- league/csv: ^9.8
- symfony/http-foundation: ^6.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.28
- mockery/mockery: ^1.4
- php-parallel-lint/php-parallel-lint: ^1.3
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.8
- phpstan/phpstan-mockery: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5.20
README
Csv exporter for Symfony
Installation
$ composer require mf/csv-exporter
Requirements
PHP 8.0
- league/csv
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'], ]; } );