flow php

UNIFIED DATA PROCESSING FRAMEWORK

composer require flow-php/etl ^0.10.0

Changelog

elephant
extract

Extracts

Read from various data sources.

arrow
transform

Transforms

Shape and optimize for your needs.

arrow
load

Loads

Store and secure in one of many available data sinks.

Definition


feature source
/**
 * @param Path|string $path
 * @param bool $empty_to_null - @deprecated use $loader->withEmptyToNull() instead
 * @param bool $with_header - @deprecated use $loader->withHeader() instead
 * @param null|string $separator - @deprecated use $loader->withSeparator() instead
 * @param null|string $enclosure - @deprecated use $loader->withEnclosure() instead
 * @param null|string $escape - @deprecated use $loader->withEscape() instead
 * @param int<1, max> $characters_read_in_line - @deprecated use $loader->withCharactersReadInLine() instead
 * @param null|Schema $schema - @deprecated use $loader->withSchema() instead
 */
from_csv(Path|string $path, bool $with_header, bool $empty_to_null, ?string $separator, ?string $enclosure, ?string $escape, int $characters_read_in_line, ?Schema $schema) : CSVExtractor

Usage Examples


Example: Data reading - Csv

<?php

declare(strict_types=1);

use function Flow\ETL\Adapter\CSV\from_csv;
use function Flow\ETL\DSL\{data_frame, to_stream};

require __DIR__ . '/../../../autoload.php';

data_frame()
    ->read(from_csv(
        __DIR__ . '/input/dataset.csv',
        with_header: true,
        empty_to_null: true,
        separator: ',',
        enclosure: '"',
        escape: '\\',
        characters_read_in_line: 1000
    ))
    ->collect()
    ->write(to_stream(__DIR__ . '/output.txt', truncate: false))
    ->run();

Contributors

Join us on GitHub external resource
scroll back to top