承接 evheniy/simple-task-fsm-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

evheniy/simple-task-fsm-bundle

最新稳定版本:1.0.0

Composer 安装命令:

composer require evheniy/simple-task-fsm-bundle

包简介

The SimpleTaskFSMBundle adds the ability to use FSM tasks runner in your application.

README 文档

README

This bundle provides the ability to use FSM tasks runner in your application.

knpbundles.com

Latest Stable Version Total Downloads Latest Unstable Version License

Scrutinizer Code Quality Build Status

Build Status

Installation

$ composer require evheniy/simple-task-fsm-bundle "1.*"

Or add to composer.json

"evheniy/simple-task-fsm-bundle": "1.*"

AppKernel:

public function registerBundles()
{
    $bundles = array(
        ...
        new Evheniy\SimpleTaskFSMBundle\SimpleTaskFSMBundle(),
    );
    ...

Documentation

For using SimpleTaskFSMBundle you need to create state classes.

For example AppBundle/FSM/StateInit:

<?php

namespace AppBundle/FSM;

use Evheniy\SimpleTaskFSMBundle\StateAbstract;

class StateInit extends StateAbstract
{

    /**
     * @throw \Evheniy\SimpleTaskFSMBundle\Exception\StateException
     */
    public function run()
    {
        //do something...
    }
}

Then create FSM manager with this state classes (for example in Command):

use Evheniy\SimpleTaskFSMBundle\FSM;

And

$fsm = new FSM(array(new StateInit()));
foreach($fsm as $state) {
    $state->run();
}

OR

$fsm = new FSM(array(new StateInit()));
$fsm->rewind();
while($fsm->valid()) {
    $fsm->current()->run();
    $fsm->next();
}

If you have exception (You can use Evheniy\SimpleTaskFSMBundle\Exception\StateException) and You need to restart step:

$fsm = new FSM(array(new StateWithError()));

$fsm->rewind();
while($fsm->valid()) {
    try {
        $fsm->current()->run();// function run() throws StateException
        $fsm->next();
    } catch (StateException $e) {
        //do something
    }
}

You can use a lot of states and they will run one by one.

$fsm = new FSM(array(new StateInit(), new StateMainTask(), new StateFinish()));

License

This bundle is under the MIT license.

Документация на русском языке

统计信息

  • 总下载量: 10.93k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-03