PHPackages                             solution-forest/workflow-engine-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. solution-forest/workflow-engine-laravel

ActiveLibrary[Framework](/categories/framework)

solution-forest/workflow-engine-laravel
=======================================

Laravel integration for the Workflow Engine - providing Eloquent models, service providers, and artisan commands for seamless workflow management

v0.0.6-alpha(4mo ago)421[2 PRs](https://github.com/solutionforest/workflow-engine-laravel/pulls)MITPHPPHP ^8.3CI passing

Since May 29Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/solutionforest/workflow-engine-laravel)[ Packagist](https://packagist.org/packages/solution-forest/workflow-engine-laravel)[ Docs](https://github.com/solutionforest/workflow-engine-laravel)[ GitHub Sponsors](https://github.com/solutionforest)[ RSS](/packages/solution-forest-workflow-engine-laravel/feed)WikiDiscussions main Synced today

READMEChangelog (6)Dependencies (16)Versions (11)Used By (0)

Laravel Workflow Engine
=======================

[](#laravel-workflow-engine)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7f1c307a897738598c988979248d6e3257c9b61f182383b76194a392578a77de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6c7574696f6e2d666f726573742f776f726b666c6f772d656e67696e652d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/solution-forest/workflow-engine-laravel)[![GitHub Tests Action Status](https://camo.githubusercontent.com/39c6cb93d3aa0bd478400f46c807ab232fa50ec43f425e0af7c2293ce2cf8c45/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736f6c7574696f6e666f726573742f776f726b666c6f772d656e67696e652d6c61726176656c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/solutionforest/workflow-engine-laravel/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/52071024c43640eaa816bce798720d6ed2ed8b16fe57115843d237fbbdf00ce1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f6c7574696f6e2d666f726573742f776f726b666c6f772d656e67696e652d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/solution-forest/workflow-engine-laravel)

**A modern, type-safe workflow engine for Laravel built with PHP 8.3+ features**

Create powerful business workflows with simple, maintainable code.

> ⚠️ **WARNING: DEVELOPMENT STATUS**⚠️
>
> This package is currently under active development and is **NOT READY FOR PRODUCTION USE**.
>
> Features may be incomplete, APIs might change, and there could be breaking changes. Use at your own risk in development environments only.

✨ Why Choose This Workflow Engine?
----------------------------------

[](#-why-choose-this-workflow-engine)

- 🎨 **Simple &amp; Intuitive** - Array-based workflow definitions and fluent WorkflowBuilder API
- 🏷️ **Modern PHP 8.3+ Attributes** - Declarative configuration with #\[WorkflowStep\], #\[Retry\], #\[Timeout\]
- 🔒 **Type Safety First** - Built with enums, strong typing, and modern PHP features
- ⚡ **Laravel Native** - Seamless integration with Laravel's ecosystem and helpers
- 🧩 **Extensible** - Easy to extend with custom actions and storage adapters
- 📚 **Well Tested** - Comprehensive test suite with real-world examples

---

🚀 Quick Start
-------------

[](#-quick-start)

### Installation

[](#installation)

```
composer require solution-forest/workflow-engine-laravel
```

Optionally publish the config file:

```
php artisan vendor:publish --tag="workflow-engine-config"
```

For database storage, run the migrations:

```
php artisan migrate
```

The migration will create a `workflow_instances` table to store workflow state and progress.

### Your First Workflow in 30 Seconds

[](#your-first-workflow-in-30-seconds)

```
use SolutionForest\WorkflowEngine\Core\WorkflowEngine;

// Create a simple workflow definition
$definition = [
    'name' => 'User Onboarding',
    'version' => '1.0',
    'steps' => [
        [
            'id' => 'welcome',
            'name' => 'Send Welcome',
            'action' => 'log',
            'parameters' => [
                'message' => 'Welcome {{ user.name }}!',
                'level' => 'info'
            ]
        ],
        [
            'id' => 'setup',
            'name' => 'Setup Account',
            'action' => 'log',
            'parameters' => [
                'message' => 'Setting up account for {{ user.email }}',
                'level' => 'info'
            ]
        ]
    ]
];

// Start the workflow using the engine
$workflowId = workflow()->start('user-onboarding-001', $definition, [
    'user' => ['name' => 'John Doe', 'email' => 'john@example.com']
]);

// Or use the helper functions
$workflowId = start_workflow('user-onboarding-002', $definition, [
    'user' => ['name' => 'Jane Doe', 'email' => 'jane@example.com']
]);
```

💼 Real-World Examples
---------------------

[](#-real-world-examples)

### E-commerce Order Processing

[](#e-commerce-order-processing)

```
$definition = [
    'name' => 'Order Processing',
    'version' => '1.0',
    'steps' => [
        [
            'id' => 'validate-order',
            'name' => 'Validate Order',
            'action' => 'log',
            'parameters' => [
                'message' => 'Validating order {{ order.id }}',
                'level' => 'info'
            ]
        ],
        [
            'id' => 'process-payment',
            'name' => 'Process Payment',
            'action' => 'log',
            'parameters' => [
                'message' => 'Processing payment for {{ order.total }}',
                'level' => 'info'
            ]
        ],
        [
            'id' => 'fulfill-order',
            'name' => 'Fulfill Order',
            'action' => 'log',
            'parameters' => [
                'message' => 'Order {{ order.id }} fulfilled',
                'level' => 'info'
            ]
        ]
    ]
];

$workflowId = start_workflow('order-001', $definition, [
    'order' => ['id' => 'ORD-001', 'total' => 99.99]
]);
```

### Document Approval Process

[](#document-approval-process)

```
$definition = [
    'name' => 'Document Approval',
    'version' => '1.0',
    'steps' => [
        [
            'id' => 'submit',
            'name' => 'Submit Document',
            'action' => 'log',
            'parameters' => [
                'message' => 'Document {{ document.id }} submitted by {{ user.name }}',
                'level' => 'info'
            ]
        ],
        [
            'id' => 'review',
            'name' => 'Manager Review',
            'action' => 'log',
            'parameters' => [
                'message' => 'Document {{ document.id }} under review',
                'level' => 'info'
            ]
        ],
        [
            'id' => 'approve',
            'name' => 'Final Approval',
            'action' => 'log',
            'parameters' => [
                'message' => 'Document {{ document.id }} approved',
                'level' => 'info'
            ]
        ]
    ]
];

$workflowId = start_workflow('doc-approval-001', $definition, [
    'document' => ['id' => 'DOC-001'],
    'user' => ['name' => 'John Doe']
]);
```

### User Onboarding

[](#user-onboarding)

```
$definition = [
    'name' => 'User Onboarding',
    'version' => '1.0',
    'steps' => [
        [
            'id' => 'welcome',
            'name' => 'Send Welcome Message',
            'action' => 'log',
            'parameters' => [
                'message' => 'Welcome {{ user.name }}! Starting onboarding...',
                'level' => 'info'
            ]
        ],
        [
            'id' => 'setup-profile',
            'name' => 'Setup User Profile',
            'action' => 'log',
            'parameters' => [
                'message' => 'Setting up profile for {{ user.email }}',
                'level' => 'info'
            ]
        ],
        [
            'id' => 'complete',
            'name' => 'Complete Onboarding',
            'action' => 'log',
            'parameters' => [
                'message' => 'Onboarding complete for {{ user.name }}',
                'level' => 'info'
            ]
        ]
    ]
];

$workflowId = start_workflow('onboarding-001', $definition, [
    'user' => ['name' => 'Jane Doe', 'email' => 'jane@example.com']
]);
```

### Creating Custom Actions

[](#creating-custom-actions)

```
