2017 © Pedro PelĂĄez
 

lib simple-workflow-manager

A simple workflow to manage model steps easily.

image

coo/simple-workflow-manager

A simple workflow to manage model steps easily.

  • Saturday, December 8, 2012
  • by Ph3nol
  • Repository
  • 3 Watchers
  • 8 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

SimpleWorkflowManager

PHP library for easy workflow management., (*1)

Requirements

  • PHP 5.3+

Installation

Add to your project Composer packages

Just add coo/simple-workflow-manager package to the requirements of your Composer JSON configuration file, and run php composer.phar install to install it., (*2)

Install from GitHub

Clone this library from Git with git clone https://github.com/Coodit/SimpleWorkflow.git., (*3)

Goto to the library directory, get Composer phar package and install vendors:, (*4)

curl -s https://getcomposer.org/installer | php
php composer.phar install

You're ready to go., (*5)

Configuration

First, you must create your first workflow. Here is an example:, (*6)

``` php getModel() to access your model * at any time. */ if ($this->getModel()->hasFooBarOption()) { $this->executePending(); } } public function executePending() { // Your logic. } public function executeDuring() { // Your logic. } public function executeComplete() { // Your logic. } /** * You must have a getModelStatus method to use * actual model status at any time. */ public function getModelStatus() { return $this->model->getStatus(); } } ``` ## Usage ``` php array(), 'during' => array('icon' => 'icon-during.png'), 'valid' => array('icon' => 'icon-valid.png'), 'complete' => array( 'icon' => 'icon-complete.png', 'other-parameter' => 'param' ), ); /** * Use default factory or create yours, based on it, or * call the manager from your DiC container. */ $workflowManager = WorkflowFactory::create($orderConfig); /** * Instanciate your specific worflow. */ $exampleWorkflow = new ExampleWorkFlow(); $exampleWorkflow->setModel(new ExampleEntity()); $workflowManager->setModelWorkflow($exampleWorkflow); /** * Steps calls examples. * * $workflowManager->executeCurrent(); * $workflowManager->executeNext(); * $workflowManager->executePrevious(); * $workflowManager->executeFirst(); * $workflowManager->executeLast(); * $workflowManager->executeToEnd(); * * You can jump to a specific step. * Use execute() to go to a step and executeTo() for * passing through each transitive ones. * Theses methods must have your step key as argument * ('pending', 'during', etc.). * * $workflowManager->execute('stepKey'); * $workflowManager->executeTo('stepKey') * * Here is an example: */ if ($workflowManager->executeNext()) { // Success. } else { // Fail. } ``` Here is an example to use step collection. ```shell , (*7)

    getStepCollection() as $step): ?>
  •         <?php if ($step->hasProperty('icon')): ?>
                <span class="icon <?php echo $step->getProperty('icon') ?>"></span>
            <?php endif; ?>
    
            <?php echo $step ?>
        </li>
    <?php endforeach ?>

    , (*8)

```

The Versions

08/12 2012

dev-master

9999999-dev https://github.com/Coodit/SimpleWorkflowManager

A simple workflow to manage model steps easily.

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

by CĂ©dric Dugat
by Florent Mondoloni

collection simple manager workflow step