Skip to content
Branch: 2.x
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github DevKit updates Jan 10, 2019
.travis DevKit updates Jan 23, 2019
docs [Docs] big cleanup Jan 17, 2019
src Fix deprecation for symfony/config 4.2+ May 16, 2019
tests Fix realpath on tests (#301) May 16, 2019
.editorconfig DevKit updates Jan 23, 2019
.flintci.yml DevKit updates (#259) Dec 6, 2018
.gitattributes DevKit updates (#280) Jan 15, 2019
.gitignore
.php_cs DevKit updates Dec 6, 2017
.php_cs.dist DevKit updates Apr 24, 2019
.travis.yml DevKit updates (#287) Feb 5, 2019
.yamllint DevKit updates (#209) Dec 26, 2017
CHANGELOG.md 2.0.1 Jan 26, 2019
CONTRIBUTING.md DevKit updates (#299) May 7, 2019
LICENSE DevKit updates (#223) May 6, 2018
Makefile DevKit updates (#287) Feb 5, 2019
README.md Add table of contents (#181) Oct 15, 2017
UPGRADE-1.x.md 1.6.0 Aug 1, 2016
UPGRADE-2.0.md Spell exporter properly Dec 15, 2018
UPGRADE-2.x.md 2.x-dev Dec 15, 2018
composer.json Cleanup composer suggest section Mar 15, 2019
phpunit.xml.dist DevKit updates for 1.x branch (#235) Sep 10, 2018

README.md

Data Exporter

Build Status

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

Installation using Composer

composer require sonata-project/exporter

Usage

<?php

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');
$stm->execute();

$source = new PDOStatementSourceIterator($stm);

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

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

Documentation

Support

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.

Note for Symfony2 users

  • For Symfony >=2.3, use tag ^1.4
  • For Symfony 2.2, use tag 1.3.1
  • For Symfony 2.1, use tag 1.2.3
  • For Symfony 2.0, use tag 1.1.0
You can’t perform that action at this time.