markusbiggus/stateengine
Composer 安装命令:
composer require markusbiggus/stateengine
包简介
Finite state automata engine
README 文档
README
Finite State Automata for Laravel/PHP Framework
Overview
This package is a State Engine that executes workflows based on a state model. Essentially, a finite state automata.
It can work in a similar way to Laravel pipeline if each step in the pipeline is a state with at most one defined transition to the next state(s). Imagine the pipeline twisted into a knot with splits and joins for fully dynamic logic flow.
The StateEngine allows multiple possible transitions from each state to one or more states, according to a state model. Each State is a class object that has the responsibility for executing the state logic and choosing which transition to emit when done. A state may be executed more than once, until it emits a transition. The engine dispatch cycle runs each state in according to the transitions they emit until the Terminal state is executed. Two dispatch cycles with no transition emitted or state changes will stall the workflow with a Runtime Exception.
If all states in a model have only a single transition choice, the state does not need to emit the transition, it will behave like a pipeline. The 'Split' transition allows a pipeline to branch multiple paths, each a pipeline running in parallel. A state with no transition choice will end a path.
A reference model is included to demonstrate how the state model is implemented.
Tests
There are tests using the reference model to demonstrate the a Workflow with several different paths through the model. Additional tests demonstrate other aspects of combining special transitions as well as how the Engine can fail when transitions are not emitted as required.
Installation
Use Composer to install the package and all necessary dependencies.
composer require markusbiggus/stateengine
Running tests
Publish tests before running.
php artisan vendor:publish --provider="MarkusBiggus\StateEngine\StateEngineProvider"
php artisan test
MIT License
Copyright (c) 2024 Mark Charles
stateengine is open-source software, licensed under the [MIT license] (LICENSE.md).
markusbiggus/stateengine 适用场景与选型建议
markusbiggus/stateengine 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 07 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「workflow」 「laravel」 「automata」 「pipeline」 「state model」 「state engine」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 markusbiggus/stateengine 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 markusbiggus/stateengine 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 markusbiggus/stateengine 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Workflow for NetCommons Plugin
FormalTheory is a library that allows for manipulation and conversion of NFAs, DFAs and Regular Expressions.
Workflow logger
State machines for Eloquent models with Enums
Approval Workflow Engine for Filament
Operational approvals engine for Laravel applications.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-07-29