sonsofphp/state-machine
最新稳定版本:v0.3.10
Composer 安装命令:
composer require sonsofphp/state-machine
包简介
Basic, yet powerful, state machine
README 文档
README
<?php use SonsOfPHP\Component\StateMachine\StateMachine; $sm = new StateMachine([ 'graph' => 'order', 'supports' => [ OrderInterface::class, ], 'transitions' => [ 'create' => [ 'from' => 'draft', 'to' => 'new', ], 'fulfill' => [ 'from' => 'new', 'to' => 'fulfilled', ], 'cancel' => [ 'from' => ['draft', 'new', 'fulfilled'], 'to' => 'fulfilled', ], ], ]); // Check if state can change $sm->can($order, 'create'); // Apply transition $sm->apply($order, 'fulfil'); // Get Current State $sm->getState($order);
Learn More
- Documentation
- Contributing
- Report Issues and Submit Pull Requests in the Mother Repository
- Get Help & Support using Discussions
统计信息
- 总下载量: 1.39k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-03