PHPackages                             vanilo/workflow - 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. vanilo/workflow

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

vanilo/workflow
===============

Workflow Engine / State Machine

1.3.0(2mo ago)115.8k↓37.5%MITPHPPHP ^8.1CI passing

Since Mar 14Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/vanilophp/workflow)[ Packagist](https://packagist.org/packages/vanilo/workflow)[ GitHub Sponsors](https://github.com/fulopattila122)[ RSS](/packages/vanilo-workflow/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

A Simple PHP Workflow Engine (State Machine)
============================================

[](#a-simple-php-workflow-engine-state-machine)

[![Tests](https://camo.githubusercontent.com/783e92417b43acf831a6a3686393fa713329be268aa67897b932e6459ae6bf0d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f76616e696c6f7068702f776f726b666c6f772f74657374732e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/vanilophp/workflow/actions?query=workflow%3Atests)[![Packagist Stable Version](https://camo.githubusercontent.com/6914f9fa8cc770c471420332251b34eb1ac0e59ac6d18176771b320b340bf270/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76616e696c6f2f776f726b666c6f772e7376673f7374796c653d666c61742d737175617265266c6162656c3d737461626c65)](https://packagist.org/packages/vanilo/workflow)[![StyleCI](https://camo.githubusercontent.com/74913e7ecae6750be5d5b839e47764427b131e52207f93d1542267d57677804c/68747470733a2f2f7374796c6563692e696f2f7265706f732f3631333438333535342f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/613483554)[![Packagist downloads](https://camo.githubusercontent.com/440eb632ba58a4c06568d9b4399b13f080348d3fe2ad0def6cf21e1faa0abcae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76616e696c6f2f776f726b666c6f772e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vanilo/workflow)[![MIT Software License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

This is a PHP engine that can take a subject (entity, document, db record) that has an enum property (either a native PHP enum or [Konekt Enum](https://konekt.dev/enum)) that represents the state of the subject.

The workflow is defined around the possible states (values of the enum).

Transitions can be defined from one state to another.

Example
-------

[](#example)

```
class OrderWorkflow extends \Vanilo\Workflow\Draft
{
    private static string $enumClass = OrderStatus::class;
    private static string $property = 'status';

    private static array $graph = [
        'name' => 'Order Workflow',
        'transitions' => [
            'prepare' => [
                'from' => [OrderStatus::NEW, OrderStatus::PENDING],
                'to' => OrderStatus::PROCESSING,
            ],
            'ship' => [
                'from' => [OrderStatus::PROCESSING],
                'to' => OrderStatus::COMPLETED,
            ],
            'cancel' => [
                'from' => ['*'],
                'to' => OrderStatus::CANCELED,
            ],
        ],
    ];
}

$order = Order::find(1);
echo $order->status->value;
// PROCESSING

$workflow = OrderWorkflow::for($order);
$workflow->can('prepare');
// false
$workflow->can('cancel');
// true

$workflow->allowedTransitions()
// ['ship, 'cancel']

$workflow->execute('ship');
echo $order->status->value;
// COMPLETED
```

Writing Explicit Transitions
----------------------------

[](#writing-explicit-transitions)

By default, executing transitions will mutate the subject's state to the desired end state.

But it's also possible to explicitly define methods that will be called instead.

```
class OrderWorkflow extends \Vanilo\Workflow\Draft
{
    private static string $enumClass = OrderStatus::class;
    private static string $property = 'status';

    private static array $graph = [
        'transitions' => [
            'cancel' => [
                'from' => ['*'],
                'to' => OrderStatus::CANCELED,
            ],
        ],
    ];

    public function cancel(Order $order): void
    {
        foreach ($order->items as $item) {
            Inventory::release($item->sku, $item->quantity)
        }

        $order->status = OrderStatus::CANCELED;
        $orders->save();

        Event::dispatch(new OrderCanceled($order));
    }
}
```

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance88

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~378 days

Total

4

Last Release

62d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3653935?v=4)[Vanilo](/maintainers/vanilo)[@Vanilo](https://github.com/Vanilo)

---

Top Contributors

[![fulopattila122](https://avatars.githubusercontent.com/u/1162360?v=4)](https://github.com/fulopattila122 "fulopattila122 (12 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vanilo-workflow/health.svg)

```
[![Health](https://phpackages.com/badges/vanilo-workflow/health.svg)](https://phpackages.com/packages/vanilo-workflow)
```

###  Alternatives

[konekt/concord

Concord is a Laravel Extension for building modular Laravel Applications

2361.4M95](/packages/konekt-concord)[vanilo/framework

E-commerce Framework for Laravel

86569.7k4](/packages/vanilo-framework)[konekt/address

Laravel module for handling countries, cities, addresses, people and organizations

18233.1k25](/packages/konekt-address)[vanilo/cart

Vanilo Cart Module

51138.6k2](/packages/vanilo-cart)

PHPackages © 2026

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