PHP code example of phwoolcon / fsm
1. Go to this page and download the library: Download phwoolcon/fsm library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
phwoolcon / fsm example snippets
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