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

1.0.3 2016-02-08 16:24 UTC

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') %}