Remove rows from your dataset based on conditions. Only rows matching the filter criteria are kept in the result. This is one of the most common operations for selecting a subset of data.
UNIFIED DATA PROCESSING FRAMEWORK
composer require flow-php/etl ~0.33.0 Extracts
Read from various data sources.
Transforms
Shape and optimize for your needs.
Loads
Store and secure in one of many available data sinks.
Examples:
Description
Documentation
Code
<?php
declare(strict_types=1);
use function Flow\ETL\DSL\{data_frame, from_array, ref, to_output};
require __DIR__ . '/vendor/autoload.php';
data_frame()
->read(from_array([
['id' => 1, 'name' => 'Alice', 'age' => 25, 'active' => true],
['id' => 2, 'name' => 'Bob', 'age' => 32, 'active' => false],
['id' => 3, 'name' => 'Charlie', 'age' => 28, 'active' => true],
['id' => 4, 'name' => 'Diana', 'age' => 35, 'active' => true],
['id' => 5, 'name' => 'Eve', 'age' => 22, 'active' => false],
]))
->collect()
->filter(ref('active')->isTrue())
->write(to_output(truncate: false))
->run();