PHPackages                             imzeali/finite - 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. imzeali/finite

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

imzeali/finite
==============

A simple PHP5.3+ Finite State Machine

1.1.5(6y ago)0691MITPHPPHP &gt;=5.5

Since Mar 4Pushed 6y agoCompare

[ Source](https://github.com/imzeali/Finite)[ Packagist](https://packagist.org/packages/imzeali/finite)[ Docs](https://github.com/yohang/Finite)[ RSS](/packages/imzeali-finite/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (9)Versions (20)Used By (1)

Finite, A Simple PHP Finite State Machine
=========================================

[](#finite-a-simple-php-finite-state-machine)

Finite is a Simple State Machine, written in PHP. It can manage any Stateful object by defining states and transitions between these states.

[![Build Status](https://camo.githubusercontent.com/0ac5eb03eb772a408344d0a6373ca5c81bc13c4096ad427f9691050a9ccc6f7b/68747470733a2f2f7472617669732d63692e6f72672f796f68616e672f46696e6974652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/yohang/Finite)[![Latest Stable Version](https://camo.githubusercontent.com/d9799ce4a392cf16b187d96a2472036df7aaec7723b7d6eb26c52df72eba18e0/68747470733a2f2f706f7365722e707567782e6f72672f796f68616e672f66696e6974652f762f737461626c652e706e67)](https://packagist.org/packages/yohang/finite)[![Total Downloads](https://camo.githubusercontent.com/f9accacb3e30ef9f5f8b77f1bd2f26b2765848efe1506bd04c280d4702a2774a/68747470733a2f2f706f7365722e707567782e6f72672f796f68616e672f66696e6974652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/yohang/finite)[![License](https://camo.githubusercontent.com/7786e18942a01b088ba0a240143308b79b3e03875c963196f8a95bbdeb3dd66b/68747470733a2f2f706f7365722e707567782e6f72672f796f68616e672f66696e6974652f6c6963656e73652e706e67)](https://packagist.org/packages/yohang/finite)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/66e6557f87a15393f81b1ba5e2d8f8ce45171cdb5593d6458f28b760482a7a06/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f796f68616e672f46696e6974652f6261646765732f7175616c6974792d73636f72652e706e673f733d64366237346434366533653366363634333132373065633339323034643938373634636231326362)](https://scrutinizer-ci.com/g/yohang/Finite/)[![Code Coverage](https://camo.githubusercontent.com/16037100b2833c1ed887c122d623c7c47305cce031b7f2f6c97907534b82fa56/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f796f68616e672f46696e6974652f6261646765732f636f7665726167652e706e673f733d65313339396639306132656134326634393733653862643739303536353430666638646530636534)](https://scrutinizer-ci.com/g/yohang/Finite/)[![SensioLabsInsight](https://camo.githubusercontent.com/22ce47d7e9de57215e8be20e5bc52541439c5671174bdf13bb4cc4c09e54de27/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f33393466336138652d653663352d343130322d383937392d6433383964623264303239332f6d696e692e706e67)](https://insight.sensiolabs.com/projects/394f3a8e-e6c5-4102-8979-d389db2d0293)[![Dependency Status](https://camo.githubusercontent.com/d4f43ba37a7f7158a5f2ea96e0c9ece8176df47bac416f252765b767e6836484/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f796f68616e673a66696e6974652f312e302e332f62616467652e737667)](https://www.versioneye.com/php/yohang:finite/1.0.3)[![Reference Status](https://camo.githubusercontent.com/0d7fcc152e7b80570e521ef7dbc875b20f8093ab32c811c5c41ff35516756f68/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f796f68616e673a66696e6974652f7265666572656e63655f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/php/yohang:finite/references)[![Gitter](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/yohang/Finite?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

Features
--------

[](#features)

- Managing State/Transition graph for an object
- Defining and retrieving properties for states
- Event Listenable transitions
- Symfony2 integration
- Custom state graph loaders
- Twig Extension

Documentation
-------------

[](#documentation)

[Documentation for master (1.1)](http://finite.readthedocs.org/en/master/)

Getting started
---------------

[](#getting-started)

### Installation (via composer)

[](#installation-via-composer)

```
{
      "require": {
        "yohang/finite": "~1.1"
    }
}
```

### Version note :

[](#version-note-)

If your are using this library in a Symfony project, 1.1 version is only compatible with Symfony `>=2.6`. 1.0 is compatible with Symfony `>=2.3, state = $state;
        }

        public function getFiniteState()
        {
            return $this->state;
        }
}
```

### Initializing a simple StateMachine

[](#initializing-a-simple-statemachine)

```
use Finite\StateMachine\StateMachine;
use Finite\State\State;
use Finite\State\StateInterface;

// $document = retrieve your stateful object

$sm = new StateMachine();

// Define states
$sm->addState(new State('s1', StateInterface::TYPE_INITIAL));
$sm->addState('s2');
$sm->addState('s3');
$sm->addState(new State('s4', StateInterface::TYPE_FINAL));

// Define transitions
$sm->addTransition('t12', 's1', 's2');
$sm->addTransition('t23', 's2', 's3');
$sm->addTransition('t34', 's3', 's4');
$sm->addTransition('t42', 's4', 's2');

// Initialize
$sm->setObject($document);
$sm->initialize();

// Retrieve current state
$sm->getCurrentState();

// Can we process a transition ?
$sm->can('t34');
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 80.5% 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 ~209 days

Recently: every ~176 days

Total

13

Last Release

2302d ago

PHP version history (3 changes)1.0.0-BETA1PHP &gt;=5.3.0

1.1.0PHP &gt;=5.3.9

1.1.1PHP &gt;=5.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13485293?v=4)[zero.](/maintainers/imzeali)[@imzeali](https://github.com/imzeali)

---

Top Contributors

[![yohang](https://avatars.githubusercontent.com/u/608984?v=4)](https://github.com/yohang "yohang (165 commits)")[![winzou](https://avatars.githubusercontent.com/u/702928?v=4)](https://github.com/winzou "winzou (10 commits)")[![navitronic](https://avatars.githubusercontent.com/u/180519?v=4)](https://github.com/navitronic "navitronic (6 commits)")[![RonRademaker](https://avatars.githubusercontent.com/u/2697738?v=4)](https://github.com/RonRademaker "RonRademaker (4 commits)")[![Padam87](https://avatars.githubusercontent.com/u/776488?v=4)](https://github.com/Padam87 "Padam87 (4 commits)")[![liuggio](https://avatars.githubusercontent.com/u/530406?v=4)](https://github.com/liuggio "liuggio (2 commits)")[![tortuetorche](https://avatars.githubusercontent.com/u/5038872?v=4)](https://github.com/tortuetorche "tortuetorche (2 commits)")[![acorncom](https://avatars.githubusercontent.com/u/802505?v=4)](https://github.com/acorncom "acorncom (1 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (1 commits)")[![realshadow](https://avatars.githubusercontent.com/u/6673222?v=4)](https://github.com/realshadow "realshadow (1 commits)")[![reiz](https://avatars.githubusercontent.com/u/652130?v=4)](https://github.com/reiz "reiz (1 commits)")[![tompedals](https://avatars.githubusercontent.com/u/6132043?v=4)](https://github.com/tompedals "tompedals (1 commits)")[![nidup](https://avatars.githubusercontent.com/u/2104359?v=4)](https://github.com/nidup "nidup (1 commits)")[![arikal](https://avatars.githubusercontent.com/u/3074809?v=4)](https://github.com/arikal "arikal (1 commits)")[![dannykopping](https://avatars.githubusercontent.com/u/373762?v=4)](https://github.com/dannykopping "dannykopping (1 commits)")[![defrag](https://avatars.githubusercontent.com/u/15900?v=4)](https://github.com/defrag "defrag (1 commits)")[![imzeali](https://avatars.githubusercontent.com/u/13485293?v=4)](https://github.com/imzeali "imzeali (1 commits)")[![K-Phoen](https://avatars.githubusercontent.com/u/66958?v=4)](https://github.com/K-Phoen "K-Phoen (1 commits)")[![ksn135](https://avatars.githubusercontent.com/u/230304?v=4)](https://github.com/ksn135 "ksn135 (1 commits)")

---

Tags

symfonybundlestateworkflowstatemachinetransition

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/imzeali-finite/health.svg)

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

###  Alternatives

[yohang/finite

A simple PHP Finite State Machine

1.3k3.5M10](/packages/yohang-finite)[symfony/workflow

Provides tools for managing a workflow or finite state machine

62842.3M170](/packages/symfony-workflow)[winzou/state-machine

A very lightweight yet powerful PHP state machine

52113.7M18](/packages/winzou-state-machine)[gomachan46/state-machine

simple state machine with annotations for PHP, inspired by AASM known as a Ruby state machine.

1893.9k](/packages/gomachan46-state-machine)[winzou/state-machine-bundle

Bundle for the very lightweight yet powerful PHP state machine

34010.4M15](/packages/winzou-state-machine-bundle)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)

PHPackages © 2026

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