Download the PHP package halfowl/statemachine without Composer
On this page you can find all versions of the php package halfowl/statemachine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download halfowl/statemachine
More information about halfowl/statemachine
Files in halfowl/statemachine
Package statemachine
Short Description State Machines made safe and easy.
License MIT
Informations about the package statemachine
php-StateMachine
State Machines in PHP made safe and easy.
Installation
Using Composer:
Example
Imagine an application that holds the state of an article. It has the following states:
- Draft
- Awaiting Copy Edit
- Published
A new article starts in "Draft", gets progressed to "Awaiting Copy Edit", and subsequently "Published". An article in "Awaiting Copy Edit" can go back to being a "Draft".
With this library, you can model the above as:
API
(Proper auto-generated docs is WIP, tracking in #4)
State
Reference: https://github.com/half0wl/php-StateMachine/blob/main/src/StateInterface.php
getName(): string
StateMachine
Reference: https://github.com/half0wl/php-StateMachine/blob/main/src/StateMachineInterface.php
current(): Statecan(): boolis(State $s): booltransition(State $next): void
StateTransition
Reference: https://github.com/half0wl/php-StateMachine/blob/main/src/StateTransitionInterface.php
src(): Statedsts(): State[]inDst(): bool
License
MIT