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
Building Blocks - Chain Merge(merge)

The merge operation executes multiple chains of operations (branches) with the same input data, then combines their results back into the main chain. This is useful for performing different transformations on the same data and combining the outcomes.

Warning: If branches don’t filter or modify items, subsequent steps will receive duplicate data, as merge doesn’t handle duplicates automatically. This behavior can be leveraged to create multiple versions of an item.

Options

  • branches: An array of chains of operations.

Example

Here’s an example of how to use the merge operation to create two different versions of a product from a single input item:

chain:
  - operation: extract-csv
    options:
      path: /path/to/products.csv

  - operation: merge
    options:
      branches:
        - - operation: rule-transformer
            options:
              # Rules to create a simple product.
              rules:
                sku: "-simple"
                type: simple

        - - operation: rule-transformer
            options:
              # Rules to create a configurable product.
              rules:
                sku: "-configurable"
                type: configurable

  - operation: load-csv
    options:
      path: /path/to/merged-products.csv

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)