Logo of php-etl
Getting Started
🐘 Standalone 🎵 Symfony 🦢 Sylius
Core Concepts
The Concept Execution Context Item Types Custom Operations Glossary FAQ
⛓️ Operations
Building Blocks
Split Merge Repeat Safe
Extract
File Finder CSV JSON
Transform
External File Processor Filter Data Rule Transformer Split Item HTTP Client Log Callback
Aggregation
Simple Grouping
Load
CSV JSON
🧑‍🍳 Cookbook
Without Context
Grouping / Aggregation Filtering Splitting/Forking Making your chains configurable Complex data to csv / Flatten Data Api to CSV N°1 Api to CSV N°2 Sub chains
With Context
Api to CSV Import external file
Custom Operations

PHP-ETL - Operations
Transform - Filter Data(filter)

The filter operation selectively skips items in the chain based on a rule. It uses the rule engine to evaluate a condition; if the condition is not met, the item is not passed to subsequent operations.

Options

  • rule: The rule to be evaluated. If the rule evaluates to a “truthy” value (not null and not false), the item is kept. Otherwise, it is filtered out.
  • negate: (Optional) A boolean that, if set to true, inverts the result of the rule. In this case, items that evaluate to a “truthy” value are filtered out, and items that evaluate to a “falsy” value are kept.

Example

Here’s an example of how to use the filter operation to keep only the items where the status field is equal to "published":

chain:
  - operation: filter
    options:
      rule:
        #...

  - operation: load-to-database
    options:
      # Options to load the filtered data into a database.

Here’s an example of how to use the filter operation with negate to filter out items where the age is less than 18:

chain:
  - operation: filter
    options:
      rule:
        #...
      negate: true

  - operation: load-to-database
    options:
      # Options to load the filtered data into a database.

Network

GitHub Repo Issues Good First Issues

Help Preserve This Project

Support for the continued development of php ETL. I maintain this project in my free time.

Support
Free & Open Source (MIT)