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

ActiveLibrary

bravo3/workflow
===============

Workflow decision engine

1.1.3(10y ago)5571MITPHPPHP &gt;=5.5.0

Since Dec 17Pushed 10y ago1 watchersCompare

[ Source](https://github.com/bravo3/workflow)[ Packagist](https://packagist.org/packages/bravo3/workflow)[ RSS](/packages/bravo3-workflow/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (7)Used By (0)

Workflow Engine
===============

[](#workflow-engine)

The purpose of this library is to create a decision engine to augment workflow services such as Amazon SWF.

The decision engine allows you to create a simple schema for the workflow and minimise programmatic business logic or exposure of decision and workflow handling.

Example
=======

[](#example)

To quickly create a schema-based workflow using SWF (see Building a Workflow), you can use factories provided:

```
$factory = new SchemaWorkflowFactory(
    'Path/To/Schema.yml',
    $aws_config,    // AWS config
    $redis_config,  // Redis config
    3600,           // Redis key timeout - should be longer than the workflow start-to-close timeout
    'workflows'     // Redis namespace - used to isolate workflow activity on the server
);

```

This factory has all your workflow components will need. To create a new workflow:

```
$factory->getWorkflowEngine()->createWorkflow('sample-workflow-name');

```

On the daemon side, to listen for decisions:

```
$factory->getDecisionEngine()->daemonise();

```

And to listen for work tasks:

```
$factory->getWorkerEngine()->daemonise();

```

The `#daemonise()` functions run in a loop endlessly. To abort this loop you can pass it an abort flag (`FlagInterface`), using a `MemoryFlag` would allow you to abort on a condition in the workflow.

If you don't want to loop, you could just call `#checkForTask()`:

```
$factory->getWorkerEngine()->checkForTask();

```

Ad-Hoc Scheduling
-----------------

[](#ad-hoc-scheduling)

It's possible for a task to schedule additional tasks upon success (or manipulate the workflow in any way). This nature is controlled at the DECISION level, so the task must first succeed and then it's `onSuccess()` function will be executed by the decider. You will receive a `Decision` object which you can then use to add decisions for the decider to execute (fail execution, schedule task, etc) and use the result from the `execute()` function of your task that was executed by the worker.

Passing Data To The Worker Tasks
--------------------------------

[](#passing-data-to-the-worker-tasks)

The Worker and Decider classes have auxiliary data that can be set by calling `setAuxPayload()`. If you are using a factory, the `$payload` parameter of the factory will set the aux payload on any Worker/Decider classes it creates.

In a task you can reference this data (`getAuxPayload()` if using the AbstractTask) - this is useful for giving the task access to a larger application engine. A useful payload might be a DI container.

Application Structure
=====================

[](#application-structure)

The lowest level component is a decision or worker engine found in the Drivers namespace. Once an engine is created, you must add the appropriate Decider or Worker service (Services namespace) as a subscriber.

The engine classes will fire events when they receive decision or work tasks. The services will then action the task using a Workflow and WorkflowHistory entity. You can add multiple decision and worker services, each with their own logic. The bundled classes will follow the task requirements and close the workflow when there are no more tasks running or to be scheduled, but it is possible to completely rewrite this logic.

Tasks are worker components of a workflow - these are executed by the Worker service and run independent of the Decision service.

Memory services are interfaces to a database platform which is used to store metadata created by worker tasks.

Memory Pools
============

[](#memory-pools)

This workflow engine uses key-value memory pools to store state and ephemeral workflow information. It is the responsibility of the Task classes to persist data as required.

[Redis](docs/Redis.md) is an ideal memory pool.

Building a Workflow
===================

[](#building-a-workflow)

To run a workflow you require a workflow controller, a SaaS service like Amazon SWF that is your workflow engine controlling which activities need to be executed, and querying decision by talking to this decision interface.

In the workflow controller, you will need to define a domain, a simple name that defines your workflow environment - you may with to use a different domain for testing and production. Inside that domain, you need to define a workflow execution. This contains a default tasklist, this tasklist is your "decision tasklist", and must be defined in your workflow schema.

Defining Tasks
--------------

[](#defining-tasks)

In your workflow controller you must also define activities as steps in a workflow execution. An activity requires an `activity name` and an `activity version`. You can assign default timeout values at the SWF (or equiv provider), although you may also override these at the schema level.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~85 days

Recently: every ~93 days

Total

6

Last Release

3744d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a82084f38dfacd80655e26cd45b5bb9ab43eaa09b3a97c5c4a2350fe41b0c20?d=identicon)[jordonsc](/maintainers/jordonsc)

---

Top Contributors

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

---

Tags

workflowdeciderswf

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)

PHPackages © 2026

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