PHPackages                             iconic/engine - 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. iconic/engine

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

iconic/engine
=============

Engine is a workflow state machine that helps keeping business logic centralized

v0.1.9(5y ago)119MITPHPPHP &gt;=7.4

Since Dec 3Pushed 2y ago1 watchersCompare

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

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

Engine - PHP Workflow library
=============================

[](#engine---php-workflow-library)

Engine is heavily inspired by symfony/workflow, but meant to be significantly simpler to use, and allow extra checks about both the actor and the object of the workflow transitions and actions.

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

[](#installation)

You can install the library using composer

```
composer require iconic/engine
```

Quick Guide
-----------

[](#quick-guide)

All you have to do is create an instance of Engine and start defining and checking allowed actions on properties and from actors (supports getters/setters and public properties).

- Allow everyone to view

```
$engine = new \Iconic\Engine\Engine();
$engine->allow('view');
$allowed = $engine->can('view'); //returns true
$allowed = $engine->can('edit'); //returns false
```

- Allow publishing of posts only if their status is draft

```
$post = new Post();
$post->status = "submitted";
$engine = new \Iconic\Engine\Engine();

$engine->allow('publish')->of('status', 'draft', 'published');

$allowed = $engine->can('publish', $post); //returns false
$engine->apply('publish', $post); //throws Exception

$post->status = "draft";
$allowed = $engine->can('publish', $post); //returns true
$engine->apply('publish', $post); //changes post status to "published"
```

- Allow only actors with "role" "editor" to edit, without defining object restrictions

```
$user = new User();
$user->role = "user";

$engine = new \Iconic\Engine\Engine();
$engine->allow('edit')->if('role', 'editor');
$allowed = $engine->can('edit', null, $user); //returns false
```

- Combine the two above scenarios. Allow posts with "status" "draft" to be "published" by actors with "role" "editor"

```
$editor = new User();
$editor->role = 'editor';
$user = new User();
$user->role = 'user';
$draftPost = new Post();
$draftPost->status = "draft";
$deletedPost = new Post();
$deletedPost->status = "deleted";

$engine = new \Iconic\Engine\Engine();
$engine->allow('publish')->of('status', 'draft', 'published');
$engine->allow('publish')->if('role', 'editor');

$engine->can('publish', $draftPost, $editor); //returns true
$engine->apply('publish', $draftPost, $editor); //changes post status to "published"

$engine->can('publish', $deletedPost, $editor); //returns false
$engine->apply('publish', $deletedPost, $editor); //throws exception
$engine->can('publish', $draftPost, $user); //returns false
$engine->apply('publish', $draftPost, $user); //throws exception
```

- You can define multiple rules for each action

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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.

###  Release Activity

Cadence

Every ~0 days

Total

9

Last Release

1984d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/50078195dbf3c86bf20865950c7ffae27773ceddee24d092a896528ad8c1e82e?d=identicon)[iconic](/maintainers/iconic)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/iconic-engine/health.svg)

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

PHPackages © 2026

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