2017 © Pedro Peláez
 

library etl

Extract-Transform-Load service

image

cyve/etl

Extract-Transform-Load service

  • Tuesday, May 22, 2018
  • by cyve
  • Repository
  • 1 Watchers
  • 0 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 383 % Grown

The README.md

Extract Transform Load

Installation:

With Composer:, (*1)

composer require cyve/etl

Usage

Use case: convert CSV to JSON

$etl = new ETL(
    new CsvFileExtractor('users.csv'),
    new NullTransformer(),
    new JsonFileLoader('users.json')
);
$etl->start();

Use an event dispatcher

Use the 4th argument of the constructor to inject an instance of Psr\EventDispatcher\EventDispatcherInterface. At each step of each iteration, the ETL will dispatch an event containing the result if the operation succeeded, or an exception if the operation failed, (*2)

$eventDispatcher = new Symfony\Component\EventDispatcher\EventDispatcher();

$etl = new ETL(
    $extractor,
    $transformer,
    $loader,
    $eventDispatcher,
);
$etl->start();

Example: progress bar

$eventDispatcher = new Symfony\Component\EventDispatcher\EventDispatcher();
$eventDispatcher->addListener(LoadSuccessEvent::class, function (LoadSuccessEvent $event): void {
    echo '#';
});
$eventDispatcher->addListener(LoadFailureEvent::class, function (LoadFailureEvent $event): void {
    echo 'E';
});

The Versions

22/05 2018

dev-master

9999999-dev

Extract-Transform-Load service

  Sources   Download

MIT

The Requires

  • php >=7.0

 

22/05 2018

1.1

1.1.0.0

Extract-Transform-Load service

  Sources   Download

MIT

The Requires

  • php >=7.0

 

18/05 2018

1.0

1.0.0.0

Extract-Transform-Load service

  Sources   Download

MIT

The Requires

  • php >=7.0