grazulex/laravel-flowpipe

Composable, traceable and declarative Flow Pipelines for Laravel. A modern alternative to Laravel's Pipeline, with support for conditional steps, nested flows, tracing, validation, and more.

v1.1.0 2025-07-20 11:46 UTC

This package is auto-updated.

Last update: 2025-08-21 23:40:54 UTC


README

Laravel Flowpipe

Composable, traceable and declarative Flow Pipelines for Laravel

A modern alternative to Laravel's Pipeline with advanced features for complex workflow management

Latest Version Total Downloads License PHP Version Laravel Version Tests Code Style

🚀 Overview

Laravel Flowpipe is a powerful, modern alternative to Laravel's built-in Pipeline package that provides composable, traceable, and declarative flow pipelines. Perfect for building complex business workflows, data processing pipelines, user registration flows, API integrations, and any scenario where you need reliable, maintainable, and testable step-by-step processing.

✨ Key Features

  • 🚀 Fluent API - Chainable, expressive syntax
  • 🔄 Flexible Steps - Support for closures, classes, and custom steps
  • 🎯 Conditional Logic - Built-in conditional step execution
  • 📊 Tracing & Debugging - Track execution flow and performance
  • 🛡️ Advanced Error Handling - Retry, fallback, and compensation strategies
  • 🔗 Step Groups - Reusable, named collections of steps
  • 🎯 Nested Flows - Create isolated sub-workflows for complex logic
  • 📋 YAML Support - Define flows in YAML for easy configuration
  • 🧪 Test-Friendly - Built-in test tracer for easy testing
  • 🎨 Artisan Commands - Full CLI support for flow management
  • Flow Validation - Validate flow definitions with comprehensive error reporting
  • 📈 Export & Documentation - Export to JSON, Mermaid, and Markdown

📦 Installation

Install the package via Composer:

composer require grazulex/laravel-flowpipe

💡 Auto-Discovery: The service provider will be automatically registered thanks to Laravel's package auto-discovery.

⚡ Quick Start

🚀 Programmatic API

use Grazulex\LaravelFlowpipe\Flowpipe;

$result = Flowpipe::make()
    ->send('Hello World')
    ->through([
        fn($data, $next) => $next(strtoupper($data)),
        fn($data, $next) => $next(str_replace(' ', '-', $data)),
        fn($data, $next) => $next($data . '!'),
    ])
    ->thenReturn();

// Result: "HELLO-WORLD!"

📋 YAML Configuration (Recommended)

Laravel Flowpipe supports declarative flow definitions using YAML files, making your workflows easy to manage, version, and maintain:

Create a flow definition (flow_definitions/user_registration.yaml):

name: user_registration
description: Complete user registration workflow
steps:
  - type: validation
    rules:
      email: required|email
      password: required|min:8
  - type: closure
    action: App\Actions\CreateUserAccount
  - type: conditional
    condition:
      field: email_verification_required
      operator: equals
      value: true
    then:
      - type: closure
        action: App\Actions\SendVerificationEmail
  - type: group
    name: notifications
metadata:
  version: "1.0"
  author: "Your Team"

Execute the flow:

use Grazulex\LaravelFlowpipe\Flowpipe;

$result = Flowpipe::fromDefinition('user_registration')
    ->send($userData)
    ->thenReturn();

📁 Organize with step groups (flow_definitions/groups/notifications.yaml):

name: notifications
steps:
  - type: closure
    action: App\Actions\SendWelcomeEmail
  - type: closure
    action: App\Actions\CreateNotificationPreferences

💡 Avantages des fichiers YAML :

  • Configuration déclarative - Définissez vos workflows sans code
  • Réutilisabilité - Partagez des groupes d'étapes entre différents flux
  • Versioning facile - Trackez les changements dans votre système de contrôle de version
  • Collaboration - Les non-développeurs peuvent modifier les workflows
  • Validation - Validation automatique des définitions avec php artisan flowpipe:validate

🔧 Requirements

  • PHP 8.3+
  • Laravel 12.0+

📚 Complete Documentation

For comprehensive documentation, examples, and advanced usage guides, visit our Wiki:

📖 👉 Laravel Flowpipe Wiki

The wiki includes:

🤝 Contributing

Please see CONTRIBUTING.md for details.

🔒 Security

If you discover any security-related issues, please email jms@grazulex.be instead of using the issue tracker.

📝 Changelog

Please see RELEASES.md for more information on what has changed recently.

📄 License

The MIT License (MIT). Please see License File for more information.

👥 Credits

💬 Support

Laravel Flowpipe - A modern, powerful alternative to Laravel's built-in Pipeline
with enhanced features for complex workflow management.