itinance / tiny-state-machine
Installs: 183
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/itinance/tiny-state-machine
Requires
- php: >=5.3.2
- symfony/framework-bundle: ~2.7
- symfony/twig-bundle: ~2.7
Requires (Dev)
- phpunit/dbunit: 1.3.*
- phpunit/phpunit: 4.0.*
This package is not auto-updated.
Last update: 2025-10-12 01:08:05 UTC
README
Installation
composer require itinance/tiny-state-machine
Usage
This StateMachine enables to set some state in an application and to request this state elsewhere, even in Twig.
Setting state:
StateMachine::instance()->setState('Foobar');
Setting state with value:
StateMachine::instance()->setState('Foobar', 'barfoo');
Request state:
StateMachine::instance()->getState('Foobar' /* , $default */);
StateMachine::instance()->hasState('Foobar');
StateMachine::instance()->hasStateWithValue('Foobar', 'barfoo');
Twig:
{% if hasState('Foobar') %}