Skip to content

Jeket/exporter

 
 

Repository files navigation

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

Packages

No packages published

Languages

  • PHP 97.2%
  • Shell 1.8%
  • Makefile 1.0%