Awesome Open Source
Awesome Open Source

Data Exporter

Data Exporter is a lightweight library to export data into different formats.

Latest Stable Version Latest Unstable Version License

Total Downloads Monthly Downloads Daily Downloads

Branch Github Actions Coverage
2.x Test Coverage Status
master Test Coverage Status

Installation using Composer

composer require sonata-project/exporter



use Exporter\Handler;
use Exporter\Source\PDOStatementSourceIterator;
use Exporter\Writer\CsvWriter;

// Prepare the data source
$dbh = new \PDO('sqlite:foo.db');
$stm = $dbh->prepare('SELECT id, username, email FROM user');

$source = new PDOStatementSourceIterator($stm);

// Prepare the writer
$writer = new CsvWriter('data.csv');

// Export the data
Handler::create($source, $writer)->export();



For general support and questions, please use StackOverflow.

If you think you found a bug or you have a feature idea to propose, feel free to open an issue after looking at the contributing guide.


This package is available under the MIT license.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
php (16,078
symfony (455
client (388
data (382
csv (268
symfony-bundle (164
bundle (131
export (64
xls (29
sonata (18

Find Open Source By Browsing 7,000 Topics Across 59 Categories