Phwoolcon Finite State Machine

Maintainers

Details

github.com/phwoolcon/fsm

Source

Issues

Installs: 916

Dependents: 1

Suggesters: 0

Security: 0

Stars: 13

Watchers: 1

Forks: 0

Open Issues: 1

pkg:composer/phwoolcon/fsm

v1.0.2 2016-07-12 13:29 UTC

This package is auto-updated.

Last update: 2025-10-11 21:12:17 UTC


README

Build Status Code Coverage License

See the definition of Finite-state machine on Wikipedia

Installation

Add this library to your project by composer:

composer require "phwoolcon/fsm"

Usage

<?php
use Phwoolcon\Fsm\StateMachine;
$fsm = StateMachine::create([
    'foo' => [
        'process' => 'bar',
    ],
    'bar' => [
        'process2' => 'hello',
        'process3' => 'world',
    ],
]);
echo $fsm->getCurrentState();   // prints foo
echo $fsm->next();              // prints bar
echo $fsm->do('process2');      // prints hello