Giter Club home page Giter Club logo

workflow's Introduction

workflow

Build Status Total Downloads Latest Stable Version SensioLabsInsight

Workflow is a library that lets you first build a graph with places and transactions interconnecting them with arcs. And then lets you traverse the created workflow for any number of runs each identifiable via a token. The traversing starts on an input place node and ends in an output place node for a given workflow. Workflow uses a logger to log the flow traversing details.

The tokenable nodes can execute custom implementations. These custom implementations can be used to carry out flows on processes of a web application or other process based systems.

Install

composer require vespolina/workflow dev-master

Usage

Suppose we want a workflow like this:


  O -> [A] -> O -> [B] -> O
 in          p1          out

The code that implements and runs down on it would look like:

 <?php

use Vespolina\Workflow\Task\Automatic;
use Vespolina\Workflow\Place;
use Vespolina\Workflow\Workflow;
use Vespolina\Workflow\Token;
use Monolog\Logger;

$logger = new Logger('test');
$workflow = new Workflow($logger);

// create sequence
$a = new Automatic();
$b = new Automatic();
$p = new Place();

$workflow->connect($workflow->getStart(), $a);
$workflow->connect($a, $p);
$workflow->connect($p, $b);
$workflow->connect($b, $workflow->getFinish());

$workflow->accept(new Token());

And we will see the traversing in our logs:

... test.INFO: Token accepted into workflow
... test.INFO: Token accepted into workflow.start
... test.INFO: Token accepted into Vespolina\Workflow\Task\Automatic
... test.INFO: Token accepted into Vespolina\Workflow\Place
... test.INFO: Token accepted into Vespolina\Workflow\Task\Automatic
... test.INFO: Token accepted into workflow.finish

workflow's People

Contributors

cordoval avatar inspiran avatar

Watchers

James Cloos avatar Abishek R Srikaanth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.