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

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

rezzza/workflow
===============

Rezzza workflow

8512PHP

Since Sep 17Pushed 11y ago3 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Rezzza\\Workflow
================

[](#rezzzaworkflow)

[![Build Status](https://camo.githubusercontent.com/ca6445f5c9837bf7c542b81f181a130b3aa043f688678130c24809279296ff32/68747470733a2f2f7472617669732d63692e6f72672f72657a7a7a612f776f726b666c6f772e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rezzza/workflow)

Define workflow of an object easily.

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

[](#installation)

Through Composer :

```
$ composer require --dev "rezzza/workflow:1.0.*@dev"

```

Warning, this library uses binary system, it assigns a binary mask to each state. By this way, you'll be limited in number of states.

Usage
-----

[](#usage)

```
use \Rezzza\Workflow\Graph;
use \Rezzza\Workflow\State;
use \Rezzza\Workflow\Workflow;
use \Rezzza\Workflow\Exception;

$graph = new Graph();
$graph
    ->addState('empty', new State\NextOne())                                     // can go to filled
    ->addState('filled', new State\StateCollection(array('empty', 'confirmed'))) // can go to empty or confirmed
    ->addState('confirmed', new State\NextOne())                                 // can go to pending transaction
    ->addState('pending_transaction', new State\NextAll())                       // can go to failing_transaction or success_transaction
    ->addState('failing_transaction', new State\End())
    ->addState('success_transaction', new State\End())

$cart     = new Acme\ECommerce\Path\To\Cart();
$workflow = new Workflow($graph, $cart, 'status');
$states   = $workflow->getAuthorizedStates();

try {
    $workflow->moveToState('filled');
} catch (Exception\ConflictException e) {
    // it seems you want to add a state already setted.
} catch (Exception\WorkflowException $e) {
    // you try to set a state not authorized.
}
```

Specifications
--------------

[](#specifications)

You can add a specification to each states

```
use Rezzza\Workflow\Specification\SpecificationInterface;

class ConfirmableSpecification implements SpecificationInterface
{
    public function isSatisfiedBy($object)
    {
        return $object->hasUserAuthenticated();
    }
}

$graph = new Graph();
$graph
    //........
    ->addState('confirmed', new State\NextOne(new ConfirmableSpecification()))
    //.........
```

States
------

[](#states)

You can use each one of theses states:

NameDescriptionAllall statesEndno stateNextAllall states registered after currentNextOnenext one state registered after currentNextUntilall next states registered until defined statePreviousAllall states registered before currentPreviousOneprevious one state registered before currentPreviousUntilall previous states registered until defined stateStateCollectionstates defined via a collection of id

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/47c3006a9e7662031ee9d3fa064238fef88479fd7d60f18dd47f038fbbd7dc5a?d=identicon)[steph\_py](/maintainers/steph_py)

---

Top Contributors

[![stephpy](https://avatars.githubusercontent.com/u/232744?v=4)](https://github.com/stephpy "stephpy (4 commits)")

### Embed Badge

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

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

###  Alternatives

[laminas/laminas-eventmanager

Trigger and listen to events within a PHP application

1.0k72.5M255](/packages/laminas-laminas-eventmanager)[cebe/yii2-gravatar

Gravatar Widget for Yii 2

441.9M35](/packages/cebe-yii2-gravatar)[helthe/turbolinks

Helthe Turbolinks Component

112123.0k4](/packages/helthe-turbolinks)

PHPackages © 2026

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