cyve/etl
Composer 安装命令:
composer require cyve/etl
包简介
Extract-Transform-Load service
README 文档
README
Installation:
With Composer:
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
$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';
});
统计信息
- 总下载量: 518
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-05-19