PHPackages                             vandetho/symflow-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. vandetho/symflow-laravel

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vandetho/symflow-laravel
========================

A Symfony-compatible workflow engine for Laravel. State machines, Petri nets, guards, events, validation, weighted arcs, middleware, and YAML/JSON/PHP import/export.

v1.1.1(1mo ago)20MITPHPPHP ^8.2CI passing

Since Apr 28Pushed 1mo agoCompare

[ Source](https://github.com/vandetho/symflow-laravel)[ Packagist](https://packagist.org/packages/vandetho/symflow-laravel)[ RSS](/packages/vandetho-symflow-laravel/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (8)Versions (8)Used By (0)

SymFlow for Laravel
===================

[](#symflow-for-laravel)

[![CI](https://github.com/vandetho/symflow/actions/workflows/ci.yaml/badge.svg)](https://github.com/vandetho/symflow/actions/workflows/ci.yaml)[![Total Downloads](https://camo.githubusercontent.com/5b1d7d6289f6d55b6f8c60832c61b294f7033dccf18182da6c0ec0a6329fdb70/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76616e646574686f2f73796d666c6f772d6c61726176656c2e737667)](https://packagist.org/packages/vandetho/symflow-laravel)[![Monthly Downloads](https://camo.githubusercontent.com/744c8a38bdfb2e7cd4cf118b90b96e175f2023749b4c71a823bc3438b0417657/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f76616e646574686f2f73796d666c6f772d6c61726176656c2e737667)](https://packagist.org/packages/vandetho/symflow-laravel)[![Latest Version](https://camo.githubusercontent.com/043416e4a508d02b4d1a0c1a217df746652a2f313a88fec326206a04e94b86cb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76616e646574686f2f73796d666c6f772d6c61726176656c2e737667)](https://packagist.org/packages/vandetho/symflow-laravel)[![License](https://camo.githubusercontent.com/022c7043ebbda02459dc564c3ad1f78e1f818f2483abe3d069f73b2d879a9ab1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f76616e646574686f2f73796d666c6f772d6c61726176656c2e737667)](LICENSE)

A Symfony-compatible workflow engine for Laravel. State machines, Petri nets, guards, events, weighted arcs, middleware, and YAML/JSON/PHP/Mermaid/Graphviz/SVG import/export.

Part of the [SymFlow](https://github.com/vandetho/symflow) ecosystem. See also [symflow](https://www.npmjs.com/package/symflow) for the TypeScript/Node.js version.

Installation
------------

[](#installation)

```
composer require vandetho/symflow-laravel
php artisan vendor:publish --tag=laraflow-config
```

Quick Start
-----------

[](#quick-start)

Define a workflow in `config/laraflow.php`:

```
'workflows' => [
    'order' => [
        'type' => 'state_machine',
        'marking_store' => ['type' => 'property', 'property' => 'status'],
        'initial_marking' => ['draft'],
        'places' => ['draft', 'submitted', 'approved', 'rejected', 'fulfilled'],
        'transitions' => [
            'submit' => ['from' => 'draft', 'to' => 'submitted'],
            'approve' => ['from' => 'submitted', 'to' => 'approved'],
            'reject' => ['from' => 'submitted', 'to' => 'rejected'],
            'fulfill' => ['from' => 'approved', 'to' => 'fulfilled'],
        ],
    ],
],
```

Use the Eloquent trait:

```
use Laraflow\Eloquent\HasWorkflowTrait;

class Order extends Model
{
    use HasWorkflowTrait;

    protected function getDefaultWorkflowName(): string
    {
        return 'order';
    }
}

$order->applyTransition('submit');
$order->canTransition('approve'); // true/false
```

Or use the Facade:

```
use Laraflow\Facades\Laraflow;

$workflow = Laraflow::get('order');
$workflow->apply($order, 'submit');
```

Features
--------

[](#features)

- **Two workflow types** -- `state_machine` and `workflow` (Petri net with parallel states)
- **Symfony event order** -- `guard > leave > transition > enter > entered > completed > announce`
- **Subject-driven API** -- mirrors Symfony's `$workflow->apply($entity, 'submit')` pattern
- **Marking stores** -- `property` and `method` stores, or implement your own
- **Pluggable guards** -- `GuardEvaluatorInterface` for custom authorization
- **Structured guard results** -- return `GuardResult::deny($reason, $code)` so blockers carry a human-readable reason
- **Blockable Guard event** -- listeners can veto a transition via `$event->setBlocked(true, reason, code)`
- **Listener scoping &amp; priority** -- `on()` accepts an optional transition name and priority for declarative ordering
- **Listener error modes** -- `ListenerErrorMode::Throw / Collect / Swallow` controls how listener exceptions surface
- **Weighted arcs** -- `consumeWeight` / `produceWeight` for multi-token transitions
- **Middleware** -- wrap `apply()` with logging, transactions, metrics
- **Validation** -- 8 error types including BFS reachability analysis
- **Pattern analysis** -- AND-split, AND-join, OR-split, XOR detection
- **Import/Export** -- YAML (Symfony-compatible), JSON, PHP codegen, Mermaid, Graphviz DOT, SVG (auto-layout, dark/light theme)
- **Eloquent trait** -- `HasWorkflowTrait` for model integration
- **Laravel events** -- 7 event classes for the full transition lifecycle
- **Artisan commands** -- `laraflow:validate`, `laraflow:mermaid`, `laraflow:dot`

Examples
--------

[](#examples)

End-to-end Laravel apps built on `symflow-laravel`:

RepoWhat it shows[symflow-laravel-expense-approval](https://github.com/vandetho/symflow-laravel-expense-approval)Multi-stage expense approval as a Petri net — parallel legal/finance/manager review, Livewire 3 + Tailwind, Fly.io-ready[symflow-laravel-issue-tracker](https://github.com/vandetho/symflow-laravel-issue-tracker)Issue tracker with parallel code-review + qa-review tracks — Petri net + Livewire, Fly.io-ready[symflow-laravel-order-lifecycle](https://github.com/vandetho/symflow-laravel-order-lifecycle)Three concurrent workflows on one `Order` model — `order_lifecycle` + `order_payment` state machines and an `order_fulfillment` Petri net (parallel pick + pack), shared guard + audit middlewareDocumentation
-------------

[](#documentation)

GuideDescription[Getting Started](./docs/getting-started.md)Installation, first workflow, Eloquent trait[Engine API](./docs/engine-api.md)WorkflowEngine, guards, validation, pattern analysis[Subject API](./docs/subject-api.md)Workflow facade, marking stores, config-driven workflows[Weighted Arcs](./docs/weighted-arcs.md)Multi-token transitions[Middleware](./docs/middleware.md)Lifecycle hooks, transactions, logging[Events](./docs/events.md)Symfony event order, Laravel event integration[Artisan Commands](./docs/artisan-commands.md)validate, mermaid, dot[Persistence Formats](./docs/persistence-formats.md)YAML, JSON, PHP, Mermaid, GraphvizLicense
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance93

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

4

Last Release

37d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1325087?v=4)[Vandeth THO](/maintainers/vandetho)[@vandetho](https://github.com/vandetho)

---

Top Contributors

[![vandetho](https://avatars.githubusercontent.com/u/1325087?v=4)](https://github.com/vandetho "vandetho (39 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

symfonylaraveleventsworkflowstate-machinetransitionsguardspetri net

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/vandetho-symflow-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/vandetho-symflow-laravel/health.svg)](https://phpackages.com/packages/vandetho-symflow-laravel)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[laravel/sail

Docker files for running a basic Laravel application.

1.9k199.2M1.2k](/packages/laravel-sail)[laravel/ai

The official AI SDK for Laravel.

9782.1M153](/packages/laravel-ai)[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[flarum/core

Delightfully simple forum software.

261.4M2.2k](/packages/flarum-core)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

719160.4k12](/packages/tallstackui-tallstackui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
