1 Star 2 Fork 0

bpmn-php/laravel_workflower

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Workflower with laravel. A Bussines Process Implementation with PHP

Table of Contents

Introduction

This project is an example of https://github.com/phpmentors-jp/workflower BPMN 2.0 workflow engine and Laravel 5.8 Framework integration.

I used https://github.com/77web/workflower-bundle-playground example as basis.

The bpmn file can be viewed and edited with comunda modeler. The service tasks are not supported by the visual editor but you can edit directly in the source code.

Installation

Run composer install and and php artisan migrate command.

The workflow diagram

documentation/img/pullrequest_process.png

Sourcecode

Workflow implementations

The class Process does the magic and we focus in this.

This class needs three class to work.

  1. A WorkItemContextInterface implementation (PullRequestWorkflow). This class has the workflow bpmn file name saved in the storage/app/process path.
  2. A Bpmn2WorkflowRepository implementation (WorkflowRepository). The phpmentors-jp/workflower has an implementation but is useless for laravel projects.
  3. A MergePullRequestOperationRunner implementation (MergePullRequestOperationRunner). This class contains the logic used by the service task merge PR. For laravel projects you most consider replace service task for simple task and use Jobs.

Additionally to this classes I create the class Workflow/Entities/PullRequest that implements ProcessContextInterface and WorkflowSerializableInterface interfaces. This class it is a data structure that has the necessary data for the workflow to work.

With this classes create a Process instance.

$repository = new WorkflowRepository();
$pullRequestWorkflow = new PullRequestWorkflow();
$operationRunner = new MergePullRequestOperationRunner();
$process = new Process($pullRequestWorkflow, $repository, $operationRunner);

We set the instance in the Usecase class and pass the Pullrequest instance in the run method.

$usecase = new CreatePullRequestUsecase();
$usecase->setProcess($process); // createProcess() method in the controller class
$entity = $usecase->run($pullrequest); // $entity attribute in the controller class
return $entity;

Laravel

For persistence I create a eloquent model Models/PullRequest. This class save the data in the database including the serialized workflow.

The PullRequestController is the application's start point. This class makes the calls to the workflower engine through Usecase classes.

Screenshots

lista de pullrequest creados

documentation/img/index.png

documentation/img/index.png

空文件

简介

取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bpmn-php/laravel_workflower.git
git@gitee.com:bpmn-php/laravel_workflower.git
bpmn-php
laravel_workflower
laravel_workflower
master

搜索帮助