redcode/flow
Composer 安装命令:
composer require redcode/flow
包简介
Simple flow manager, process entities by flows (status)
README 文档
README
Steps to start
- Mark with annotation status field or status entity. Example:
use RedCode\Flow\Annotation\Status as Flow; /** * @ORM\Entity */ class Order { /** * @var OrderStatus * @Flow\StatusEntity * @ORM\ManyToOne(targetEntity="OrderStatus", cascade={"persist"}) * @ORM\JoinColumn(name="status_id") */ private $status; } use RedCode\Flow\Annotation\Status as Flow; /** * @ORM\Entity */ class OrderStatus { /** * @var int * @Flow\StatusValue * @ORM\Column(type="integer") */ private $status; }
- Create your manager and extend it from FlowManager
use RedCode\Flow\FlowManager; use RedCode\Flow\Annotation\Reader; class OrderManager extends FlowManager { public function __construct(SecurityContext $securityContext, EntityManager $em, Reader $reader, array $flows = array ()) { parent::__construct( $securityContext, $em, $reader, 'Order', // class name $flows ); } }
- Create your own flows between statuses
use RedCode\Flow\Item\BaseFlow; class SomeFlow extends BaseFlow { public function __construct() { // set allowed user roles or set false to switch off option $this->roles = [ 'ROLE_ADMIN' ]; // set allowed movements between statuses $this->movements = [ new FlowMovement(1, 2), new FlowMovement(null, 2), ]; } /** * @inheritDoc */ public function execute($entity, FlowMovement $movement) { // some actions when transit comes return $entity; } }
- Define service in xml or yaml file
<service id="order.manager" class="OrderManager"> <argument type="service" id="security.context" /> <argument type="service" id="em" /> <argument type="service"> <service class="RedCode\Flow\Annotation\Reader"> <argument type="service" id="annotation_reader"/> <argument type="service" id="em"/> </service> </argument> <argument type="collection"> <argument type="service"> <service class="SomeFlow"> </service> </argument> </argument> <argument type="service" id="em" /> </service>
- Use service in your code
/** * Modify order or it status and save using method execute */ $container->get('order.manager')->execute($order);
redcode/flow 适用场景与选型建议
redcode/flow 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 80 次下载、GitHub Stars 达 0, 最近一次更新时间为 2013 年 02 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「flow」 「symfony」 「status」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 redcode/flow 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 redcode/flow 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 redcode/flow 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Serves functionality of healthchecks of your application
Doctrine implementation of the MetaborStd (Statemachine) for PHP 8.2+
Put images nicley in a row
404 'not found' and 403 'forbidden' error handlers. The 404 handler shows custom content for missing pages but not resources like CSS or JS. The 403 handler redirects to a login URL on unauthorized access.
The bundle for easy using json-rpc api on your project
Create link to static resources with cache-breaking segment based on md5 of the file
统计信息
- 总下载量: 80
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2013-02-14