Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.15 KB

Introduction.md

File metadata and controls

34 lines (26 loc) · 1.15 KB

Introduction

PHP ETL provides the Extract, Transform and Load capabilities that streamline the process of data manipulation.


You can, for example, extract data from a csv file, trim white spaces from specific columns and then load the values into a database table:

use Wizaplace\Etl\Etl;
use Wizaplace\Etl\Extractors\Csv;
use Wizaplace\Etl\Transformers\Trim;
use Wizaplace\Etl\Loaders\Insert;
use Wizaplace\Etl\Database\Manager;
use Wizaplace\Etl\Database\ConnectionFactory;

$connexionFactory = new ConnectionFactory();
$manager = new Manager($connexionFactory);
$etl = new Etl();
$extractor = new Csv();
$transformer = new Trim();
$loader = new Insert($manager);

$etl->extract($extractor, '/path/to/users.csv')
    ->transform($transformer, [$transformer::COLUMNS => ['name', 'email']])
    ->load($loader, 'users')
    ->run();

Note that in this above example, we manually instantiate all the objects. However WP-ETL is fully compatible with any DI system, and we highly recommend to use DI. See the Getting started section for more details.

You can also easily create your own components (Extractors for instance) and integrate them in the pipeline.