flow php

UNIFIED DATA PROCESSING FRAMEWORK

composer require flow-php/etl ~0.33.0

ChangelogRelease Cycle

play Try Playground

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.

Examples:

Description

Read data from databases using Doctrine DBAL. This example demonstrates reading from a single table with pagination. Multiple extraction strategies are available including limit/offset pagination, query builders, and parameterized queries.

Documentation

Code

play
<?php

declare(strict_types=1);

use function Flow\ETL\Adapter\Doctrine\from_dbal_limit_offset;
use function Flow\ETL\DSL\{data_frame, to_output};
use Doctrine\DBAL\DriverManager;
use Flow\ETL\Adapter\Doctrine\{Order, OrderBy};

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

$connection = DriverManager::getConnection([
    'path' => __DIR__ . '/input/orders.db',
    'driver' => 'pdo_sqlite',
]);

data_frame()
    ->read(
        from_dbal_limit_offset(
            $connection,
            'orders',
            new OrderBy('created_at', Order::DESC),
        )
    )
    ->collect()
    ->write(to_output(truncate: false))
    ->run();

Contributors

Join us on GitHub external resource
scroll back to top