flow-php/etl-adapter-json

PHP ETL - Adapter - JSON

1.x-dev 2021-10-06 07:27 UTC

This package is auto-updated.

Last update: 2021-10-25 22:08:16 UTC


README

Minimum PHP Version

Description

ETL Adapter that provides memory safe JSON support for ETL.

Following implementation are available:

Entry - JsonEntry

<?php

use Flow\ETL\Row\Entry\JsonEntry;

$jsonEntry = new JsonEntry('empty', []);
$jsonObjectEntry = JsonEntry::object('empty', []);

$this->assertEquals('[]', $jsonEntry->value());
$this->assertEquals('{}', $jsonObjectEntry->value());

Extractor - JSONMachineExtractor

<?php

use Flow\ETL\Adapter\JSON\JSONMachineExtractor;
use Flow\ETL\Row;
use Flow\ETL\Rows;
use JsonMachine\JsonMachine;

$extractor = new JSONMachineExtractor(
    JsonMachine::fromFile(__DIR__ . '/../Fixtures/timezones.json'), 
    5
);

/** @var Rows $rows */
foreach ($extractor->extract() as $rows) {
    // Do something with Row 
}

Development

In order to install dependencies please, launch following commands:

composer install

Run Tests

In order to execute full test suite, please launch following command:

composer build

It's recommended to use pcov for code coverage however you can also use xdebug by setting XDEBUG_MODE=coverage env variable.