2017 © Pedro Peláez
 

library state_machine

image

tiddr/state_machine

  • Tuesday, July 15, 2014
  • by tiw
  • Repository
  • 1 Watchers
  • 3 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Build status, (*1)

state_machine

中文介绍, (*2)

A state machine implemetation in PHP. This implementation is mostly inspired from "Domain Specifi Languages" of Martin Flower., (*3)

State Machine in essential is a collection of State, Event and Transistion., (*4)


+---------+ +---------+ | | | | | +---------------+ | +---------+ +---------+ State1 Event target

In this implementation the description of a state machine could be written in yml., (*5)

An example state machine could be like:, (*6)

Name: door

Start: "dc"

Event:
- ["close door", "CD"]
- ["open door", "OD"]
- ["open window", "OW"]
- ["close window", "CW"]


State:
- "dc"
- "do"
- "wo"
- "wc"

Transition:
- ["dc", "OD", "do"]
- ["do", "OW", "wo"]
- ["wo", "CW", "wc"]
- ["do", "CD", "dc"]

In '''Event''' block all events are listed in the format [name, code]. Code must be unique. This code is also used to drive the machine., (*7)

In '''State''' block all states are listed in the format "name"., (*8)

In '''Transition''' block all transitions are listed in the format [startState, event, targetState]., (*9)

The sample use of state machine and controller could be see in the test directory., (*10)

Install per Composer

{

    "require": {
        "tiddr/state_machine": "dev-master"
    }
}

Then just add, (*11)

require_once __DIR__.'/vendor/autoload.php';

Example

Take a look at the files under directory tests, (*12)

The Versions

15/07 2014

dev-master

9999999-dev

  Sources   Download

19/05 2014

dev-develop

dev-develop

  Sources   Download

19/05 2014

dev-feature/approve_example

dev-feature/approve_example

  Sources   Download

16/05 2014

dev-feature/composer_autoload

dev-feature/composer_autoload

  Sources   Download