2017 © Pedro Peláez
 

library form-data-exporter

Simple Export Db -> CSV library

image

mixpo/form-data-exporter

Simple Export Db -> CSV library

  • Friday, October 16, 2015
  • by samkeen
  • Repository
  • 17 Watchers
  • 0 Stars
  • 1,393 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

Form Data Exporter

A somewhat specific tool meant to export to CSV, a JSON data column for all rows in a SQL result set., (*1)

Status

Build Status, (*2)

Coverage Status, (*3)

Install

composer install

phpunit

Usage

<?php

$exporter = new FormExporter(
    'dsn', // <- PDO DSN string including credentials
    'tableName', // <- the table the you wish to export data from
    'data', // <- the name of the 'data' column (column that hold the JSON form data)
    ["client_id" => "12345", "campaign" => "widget-2015"], // <- criteria used to build an AND'ed WHERE clause
    $logger // <- Psr\Log\LoggerInterface
);

You then set the writer engine (file system and S3 are currently supported and run the export, (*4)


$exporter->setExporterEngine( new FileSystemExporterEngine( 'file:///var/data/csv/leadgen99.csv', // <- full path to the output CSV in <protocol>://<path> format s3://<bucket>/<object-path> is also supported $logger, // <- Psr\Log\LoggerInterface $randomizeFileName = true ) ); $outputCsvFilePath = $exporter->run();

NOTE In the example above the $outputCsvFilePath will have a random seed in it. For instance with file:///var/data/csv/leadgen99.csv sent into the ExporterEngine constructor, $outputCsvFilePath will be something like: /var/data/csv/leadgen99-55358afdeefa5.csv, (*5)

To turn off this behavior call set $randomizeFileName = false, (*6)

Rows with Issues

After calling $exporter->run(), you can call getIssues() which will return an array of any rows that had parse issues and will not be in the CSV output., (*7)

<?php

$exporter->run();
$issues = $exporter->getIssues();

/**
 * $issues will be an empty array if there were no issues, but if there were it will look something like this.
 *      [
 *       [
 *         "message" => "Expected data field of name: 'form_data', not found for this row",
 *         "row" => ["id" => 2, 
 *                   "identifier" => "client-xyz",
 *                   "tag" => "widget-1-campaign",
 *                   "version" => 1,
 *                   "created" => "2015-04-16 21:50:39"]
 *       ],
 *       ...
 *      ]
 **/

The Versions

16/10 2015

dev-story/FL-1515/task/FL-1550_papi-receives-sns-messages

dev-story/FL-1515/task/FL-1550_papi-receives-sns-messages

Simple Export Db -> CSV library

  Sources   Download

MIT

The Requires

 

The Development Requires

15/10 2015

dev-master

9999999-dev

Simple Export Db -> CSV library

  Sources   Download

MIT

The Requires

 

The Development Requires

15/10 2015

v2.1.5

2.1.5.0

Simple Export Db -> CSV library

  Sources   Download

MIT

The Requires

 

The Development Requires

15/07 2015

v2.1.4

2.1.4.0

Simple Export Db -> CSV library

  Sources   Download

MIT

The Requires

 

The Development Requires

15/07 2015

v2.1.3

2.1.3.0

Simple Export Db -> CSV library

  Sources   Download

MIT

The Requires

 

The Development Requires

15/07 2015

v2.1.2

2.1.2.0

Simple Export Db -> CSV library

  Sources   Download

MIT

The Requires

 

The Development Requires

11/07 2015

v2.1.1

2.1.1.0

Simple Export Db -> CSV library

  Sources   Download

MIT

The Requires

 

The Development Requires

14/05 2015

2.0.0

2.0.0.0

Simple Export Db -> CSV library

  Sources   Download

MIT

The Requires

 

The Development Requires

29/04 2015

1.1.0

1.1.0.0

Simple Export Db -> CSV library

  Sources   Download

MIT

The Requires

  • php >=5.5
  • ext-pdo_pgsql *

 

The Development Requires

28/04 2015

1.0.2

1.0.2.0

Simple Export Db -> CSV library

  Sources   Download

MIT

The Requires

  • php >=5.5
  • ext-pdo_pgsql *

 

The Development Requires

28/04 2015

1.0.1

1.0.1.0

Simple Export Db -> CSV library

  Sources   Download

MIT

The Requires

  • php >=5.5
  • ext-pdo_pgsql *

 

The Development Requires

23/04 2015

1.0.0

1.0.0.0

Simple Export Db -> CSV library

  Sources   Download

MIT

The Requires

  • php >=5.5
  • ext-pdo_pgsql *

 

The Development Requires