Andach Laravel Extract and Transform (LEaT) Docs
This package will allow you to easily automate ETL processes using Laravel.
Extraction can be performed from CSV or SQL sources, with other connectors planned soon.
Transformation is from internal SQL table to internal SQL table.
Extract
$dbSource = ExtractAndTransform::createSource('Legacy DB', 'sql', [
'driver' => 'mysql',
'host' => '192.168.1.50',
'database' => 'legacy_app',
'username' => 'readonly_user',
'password' => 'secret',
]);
$dbSource->sync('users')
->withStrategy('full_refresh')
->toTable('legacy_users')
->run();
Transform
$transform = ExtractAndTransform::transform('Advanced Transform')
->from('raw_products')
->select([
'final_price_plus_vat' => Expr::col('price')
->multiply(1.2),
'final_price_plus_vat_and_shipping' => Expr::col('price')
->multiply(1.2)
->add(4.99),
'slug' => Expr::col('name')
->replace(' ', '-')
->lower(),
'report_name' => Expr::concat(Expr::col('brand'), ': ', Expr::col('name'))->upper(),
])
->toTable('advanced_products')
->run();