flow-php/etl
Flow PHP ETL is a strongly typed, generator-powered ETL framework for efficient extract-transform-load pipelines in PHP. Process large datasets with a minimal memory footprint and plug into many adapters, extractors, and loaders for diverse sources.
Laravel Ecosystem Synergy:
DatabaseExtractor, ApiLoader) to be registered as bindings. Leverages Laravel’s app() helper or facades for resolution..env and config/ patterns. Adapters can be configured via config/etl.php with environment variables (e.g., DB_CONNECTION, API_TOKEN).php artisan etl:run --pipeline=users), enabling scheduled execution via Laravel’s schedule() or cron.Illuminate\Bus\Queueable) enables async processing. Jobs can be dispatched with retries, timeouts, and monitoring via Horizon.EtlJobStarted, EtlJobFailed) can integrate with Laravel’s event system for observability (e.g., logging, notifications).Database/ORM:
EloquentExtractor/EloquentLoader adapters can abstract CRUD operations into ETL pipelines. Example:
$pipeline = new Pipeline([
new ExtractFromEloquent(User::query()),
new TransformWith([...]),
new LoadToEloquent(User::class),
]);
DB::table('orders')->select([...])).HTTP/API:
Http facade or Guzzle for API extractions/loads. Supports middleware (e.g., auth, rate limiting).Broadcasting or HandleIncomingWebhook traits.Storage:
Storage facade (e.g., S3, local files) for CSV/JSON extractions/loads.Observability:
Log facade for pipeline events (e.g., info('ETL step completed')).Assessment Phase:
DatabaseExtractor + CsvLoader pipeline.Pilot Implementation:
// app/Pipelines/ReportPipeline.php
use Flow\ETL\Pipeline;
use Flow\ETL\Extractors\DatabaseExtractor;
use Flow\ETL\Loaders\CsvLoader;
class ReportPipeline extends Pipeline {
public function __construct() {
$this->add(new DatabaseExtractor('SELECT * FROM orders'));
$this->add(new TransformWith([...]));
$this->add(new CsvLoader(storage_path('app/reports/orders.csv')));
}
}
EtlJob::dispatch(new ReportPipeline())->onQueue('etl');
Incremental Rollout:
HttpExtractor).Queue Adoption:
app/Console/Kernel.php:
protected function schedule(Schedule $schedule): void {
$schedule->job(new \App\Jobs\Etl\SyncUsersJob)->everyMinute();
}
Observability Setup:
// app/Listeners/LogEtlJob.php
public function handle(EtlJobStarted $event) {
Log::channel('etl')->info('Job started', ['job' => $event->job]);
}
| Laravel Feature | Compatibility | Notes |
|---|---|---|
| PHP 8.0+ | ✅ Full support (typed properties, attributes). | Uses PHP 8.1+ features where possible (e.g., enums). |
| Laravel 9/10 | ✅ Compatible with latest Laravel LTS. | Tested with Laravel 10.x; no major breaking changes expected. |
| Queues (Database, Redis) | ✅ Native support via Queueable interface. |
Works with Laravel’s queue workers (Supervisor, Foreman). |
| Horizon | ✅ Partial (custom events needed for dashboards). | Extend Horizon’s job monitoring with ETL-specific metrics. |
| Events | ✅ First-class integration. | Emit custom events for pipeline lifecycle hooks. |
| Service Container | ✅ Seamless binding/resolution. | Adapters can be registered as Laravel bindings. |
| Testing (Pest/PHPUnit) | ✅ Mockable adapters and pipelines. | Use Mockery to test extractors/loaders in isolation. |
| Artisan | ✅ CLI commands for ETL jobs. | Schedule via schedule() or cron. |
| Database (Eloquent/Query) | ✅ Custom adapters possible. | Example: EloquentExtractor for model-based extractions. |
| Filesystems | ✅ Works with Laravel’s Storage facade. |
Supports S3, local, FTP, etc. |
| Caching | ✅ Redis/Memcached for intermediate storage. | Useful for complex transformations. |
| Notifications | ✅ Integrate with Laravel’s notifications. | Example: Notify Slack on job failure. |
| Scout/Algolia | ⚠️ Limited (custom adapter needed). | Not natively supported; would require a ScoutLoader. |
| Vapor/AWS | ✅ Works with AWS SDK (e.g., S3 adapters). | Leverage Laravel Vapor’s AWS integration. |
| Passport/Sanctum | ✅ API auth via Laravel’s HTTP clients. | Use HttpExtractor with auth middleware. |
Phase 1: Foundation (1-2 Sprints)
config/etl.php.ETLServiceProvider.Phase 2: Core Pipelines (2-3 Sprints)
Phase 3: Optimization (1 Sprint)
Phase 4: Expansion (Ongoing)
How can I help you explore Laravel packages today?