Dev-first ETL engine for Laravel - Easily import data from CSV, Excel, JSON, and XML into your Eloquent models.
- Multi-format support: CSV, Excel (XLSX), JSON, JSON Lines, and XML
- Declarative mapping: JSON-based configuration to map columns to models
- Nested relations: Automatic handling of complex Eloquent relationships (BelongsTo, HasMany, HasOne, BelongsToMany)
- Transformations: Flexible data transformation system (trim, lower, upper, cast, etc.)
- Performance: Chunked processing for large files
- Execution order: Automatic calculation of model dependency order
- Duplicate handling: Strategies for handling duplicate records (error, skip, update)
- Pivot sync: Support for many-to-many relation synchronization
- File sanitization: BOM removal, newline normalization, control character removal
- Format detection: Automatic detection of file formats
- Data profiling: Quality analysis and statistics
- MCP-First integration: Model Context Protocol server for assisted configuration
- Standalone analysis command:
inflow:analyzeto generate analysis.json - Standalone validation command:
inflow:validatefor mapping validation - Complete flow_config: Full automation support for recurring imports
- Custom transform registration: Plugin system for custom transformations
- Circular dependency resolution: Automatic handling of circular model dependencies
composer require fabio-guin/laravel-inflowTo contribute or test in local development:
{
"repositories": [
{
"type": "path",
"url": "./packages/inflow"
}
],
"require": {
"fabio-guin/laravel-inflow": "@dev"
}
}Use the interactive command to create a mapping:
php artisan inflow:make-mapping path/to/file.csv App\\Models\\UserOr create a mapping.json file manually:
{
"version": "1.0",
"name": "User Import",
"mappings": [
{
"model": "App\\Models\\User",
"execution_order": 1,
"columns": [
{
"source": "email",
"target": "email",
"transforms": ["trim", "lower"]
},
{
"source": "nome",
"target": "name",
"transforms": ["trim"]
}
],
"options": {
"unique_key": "email",
"duplicate_strategy": "update"
}
}
]
}php artisan inflow:process file.csv --mapping=mapping.jsonComplete documentation is available in the package's docs folder:
- Getting Started - Quick guide
- Architecture - How the system works
- Mapping JSON Schema - Complete mapping schema
- Workflow - Advanced workflows
- Nested Relations - Handling complex relationships
- Genericity Analysis - Technical analysis of genericity
inflow:process- Run the import using a mapping fileinflow:make-mapping- Create or configure a mapping file interactivelyinflow:test-execution-order- Test execution order calculation (development)inflow:test-model-dependency- Test model dependency analysis (development)
inflow:analyze- Analyze a file and generateanalysis.jsoninflow:validate- Validate a mapping against an analysis
{
"mappings": [
{
"model": "App\\Models\\Author",
"execution_order": 1,
"columns": [
{"source": "author_name", "target": "name"}
]
},
{
"model": "App\\Models\\Book",
"execution_order": 2,
"columns": [
{"source": "title", "target": "title"},
{"source": "author_name", "target": "author.name"}
]
}
]
}{
"columns": [
{"source": "books", "target": "books.*.title"},
{"source": "books", "target": "books.*.isbn"}
]
}{
"model": "App\\Models\\Tag",
"execution_order": 3,
"type": "pivot_sync",
"relation_path": "App\\Models\\Book.tags",
"columns": [
{"source": "book_isbn", "target": "book.isbn"},
{"source": "tag_slug", "target": "tag.slug"}
]
}# From Laravel app root using Sail
./vendor/bin/sail exec laravel.test php packages/inflow/vendor/bin/phpunit --configuration packages/inflow/phpunit.xml
# Or from the package directory
cd packages/inflow
./vendor/bin/phpunit- PHP 8.2+
- Laravel 12.0+
- Extensions:
fileinfo,libxml,simplexml
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This package is open-source and released under the Apache License 2.0.
Active development - Phase 0
The package is under active development. APIs and features may change.
Current Implementation Status:
- Core ETL processing: Implemented
- Mapping system: Implemented
- Relation handling: Implemented
- Transformations: Implemented
- MCP integration: Planned
- Standalone analysis/validation: Planned