Download the PHP package php-architecture-kit/state-machine without Composer

On this page you can find all versions of the php package php-architecture-kit/state-machine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package state-machine

php-architecture-kit/state-machine

Graph-based state machine engine for PHP. Supports parallel pointers, conditional transitions, typed state, pluggable transition strategies, and task dispatch — all built on top of php-architecture-kit/graph.

Features

Installation

Quick Start

Core Concepts

StateMachine

Extend StateMachine and register nodes and transitions in the constructor (or any method you choose). Call execute(Execution $execution) to advance all active pointers.

Returns:

Node

Extend abstract class Node for each step in the workflow. Override handlerClass() to return the FQCN of the NodeHandlerInterface implementation resolved by the PSR-11 container.

Override transitionStrategy() to control how outgoing transitions are selected for that node (defaults to AllValidTransitionsStrategy).

NodeHandlerInterface

NodeHandlerContext provides:

Return NodeHandlerResult::Continue to let the pointer move on, or NodeHandlerResult::Suspended to pause it in place without advancing.

Transition

Directed edge between two NodeIds. Optionally attach a guard condition:

Execution

Holds all Pointers and States for one running instance.

Pointer

Tracks a single cursor position (nodeId). Pointers can be forked for parallel branches. Retrieve events (fork, remove, etc.) via $execution->pointers->getEvents().

State

Named key-value bags attached to an execution.

StateMachineConfig

Controls graph constraints and pluggable strategies:

Built-in Components

Components are reusable, pre-wired sub-graphs. Add them with $machine->addDefinition($component) and connect their ports with addTransition().

AwaitStateComponent

Suspends the pointer until a named state appears in States, with an optional timeout.

SwitchCaseComponent

Routes to the first output whose predicate returns true (XOR gateway).

ParallelComponent

Spawns one pointer per branch (AND-split). Branches can be unconditional or conditionally filtered.

AwaitAllComponent

AND-join: collects all declared branch pointers before continuing.

AsyncComponent

Dispatches a Task exactly once, then suspends until a named state confirms completion. An AwaitStateStamp is automatically added to the task envelope so the handler knows which state key to write back.

The external task handler reads AwaitStateStamp::$stateName from the envelope and calls:

Built-in Transition Strategies

Strategy Behaviour
AllValidTransitionsStrategy Evaluates all outgoing transitions; passes accepted ones forward
ForkTransitionStrategy Forks a new pointer for each accepted transition (used internally)
WaitStrategy Suspends the pointer when all transitions return Wait
WaitAndForkStrategy Waits, then forks when multiple transitions become valid
RejectStrategy Throws when no strategy matched (safety net)

Built-in Pointer Selection Strategies

Strategy Behaviour
AllPointersUntilBlockedStrategy Advances every pointer until each one blocks (default)
AllPointersStepStrategy Advances every pointer exactly one step per execute() call

License

MIT


All versions of state-machine with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
psr/clock Version ^1.0
psr/container Version ^2.0
php-architecture-kit/clock Version ^1.0
php-architecture-kit/graph Version >=1.0.1
php-architecture-kit/domain-core Version ^1.0
php-architecture-kit/uuid Version ^1.1
php-architecture-kit/technical Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package php-architecture-kit/state-machine contains the following files

Loading the files please wait ...