- 🚀 YAML-based manifest configuration
- 🔄 Flexible data transformation pipeline
- 📊 Support for complex SQL aggregations
- 🔌 Multiple export formats (CSV, JSON)
- 🔗 Automatic relationship handling
- 🎯 Group by and custom functions
- 🛡️ Error handling and validation
- 📝 Detailed logging
You can install the package via composer:
composer require laravelplus/etl-manifesto
- Create a manifest file (e.g.,
manifests/etl.yml
):
etl:
- id: monthly_user_summary
name: Monthly User Purchase Summary
description: Generate monthly user purchase statistics
source:
entities:
- users
- orders
- payments
relationships:
- users hasMany orders
- orders hasOne payments
conditions:
- orders.created_at: last_month
mapping:
- id: users.id
- name: users.name
- email: users.email
- total_orders:
function: count
column: orders.id
- total_spent:
function: sum
column: payments.amount
group_by:
- users.id
- users.name
- users.email
output:
format: csv
path: exports/monthly_user_summary.csv
- Process the ETL manifest in your code:
use Laravelplus\EtlManifesto\EtlManifesto;
$etl = new EtlManifesto();
$results = $etl->loadManifest('manifests/etl.yml')->process();
Define your data sources and their relationships:
source:
entities:
- table_name
- another_table
relationships:
- table_name hasMany related_table
- table_name belongsTo parent_table
Available mapping functions:
count
: Count recordssum
: Sum valuesavg
: Calculate averagemin
: Find minimum valuemax
: Find maximum valueconcat
: Concatenate stringscustom
: Define custom transformations
Apply transformations to your data:
transform:
- field_name: lower
- another_field: upper
- date_field: format_date
Supported export formats:
- CSV with custom delimiters and encoding
- JSON with formatting options
- Custom export handlers
Create custom transformers by extending the DataTransformer
class:
use Laravelplus\EtlManifesto\Services\DataTransformer;
class CustomTransformer extends DataTransformer
{
public function transform($value, $options)
{
// Your custom transformation logic
}
}
The package provides detailed error handling:
try {
$results = $etl->loadManifest('manifests/etl.yml')->process();
} catch (\Exception $e) {
// Handle errors
}
Contributions are welcome! Please feel free to submit a Pull Request.
The MIT License (MIT). Please see License File for more information.
- [Your Name]
- [All Contributors]
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
This package was generated using the Laravel Package Boilerplate.