PHPackages                             michaelmoussa/noodle - 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. michaelmoussa/noodle

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

michaelmoussa/noodle
====================

A finite state machine written in PHP

0.1.0(8y ago)95.4k2[4 issues](https://github.com/michaelmoussa/noodle/issues)MITPHPPHP ^7.0

Since Mar 29Pushed 8y ago1 watchersCompare

[ Source](https://github.com/michaelmoussa/noodle)[ Packagist](https://packagist.org/packages/michaelmoussa/noodle)[ Docs](https://github.com/michaelmoussa/noodle)[ RSS](/packages/michaelmoussa-noodle/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

noodle
======

[](#noodle)

Noodle is a [finite statemachine](https://en.wikipedia.org/wiki/Finite-state_machine) written in PHP 7

[![Build Status](https://camo.githubusercontent.com/00946e6c1a19489356c6eea15fad33a87a9ae286c4345cd0db0e854735c24b8e/68747470733a2f2f7472617669732d63692e6f72672f6d69636861656c6d6f757373612f6e6f6f646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/michaelmoussa/noodle)[![Code Coverage](https://camo.githubusercontent.com/93bf002730f88421c609bf45aaa0fba1b2f24d4258d1bcbc71ca6973c21efb15/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d69636861656c6d6f757373612f6e6f6f646c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/michaelmoussa/noodle/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/698e7e5cd1fbb7769cce8df753eb99e35ebc0d47e49d705509aa6e79e963ac15/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d69636861656c6d6f757373612f6e6f6f646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/michaelmoussa/noodle/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/0a2a4d32c1fb87ffe38312d1268e18d874bb1a065996a1614203f1ca7d5e2069/68747470733a2f2f706f7365722e707567782e6f72672f6d69636861656c6d6f757373612f6e6f6f646c652f762f737461626c652e706e67)](https://packagist.org/packages/michaelmoussa/noodle)[![Latest Unstable Version](https://camo.githubusercontent.com/7ac77f10a2f3b5e6fd3b75dbcbb3cfc2c959cc0ede6010066bf547a635fffc69/68747470733a2f2f706f7365722e707567782e6f72672f6d69636861656c6d6f757373612f6e6f6f646c652f762f756e737461626c652e706e67)](https://packagist.org/packages/michaelmoussa/noodle)

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

[](#installation)

The only officially supported method of installation is [Composer](http://getcomposer.org/)

```
composer require michaelmoussa/noodle
```

Usage
-----

[](#usage)

### A simple example

[](#a-simple-example)

Let's begin with the simple example of a traffic light.

There are three colors - red, yellow, and green. Red lights turn green, green lights turn yellow, and yellow lights turn red.

Such a system would look something like this:

Current StateInputNext StateREDCHANGE\_COLORGREENGREENCHANGE\_COLORYELLOWYELLOWCHANGE\_COLORREDWe can build a statemachine to represent that with Noodle as follows:

```
