PHP code example of gupalo / bpmnworkflow

1. Go to this page and download the library: Download gupalo/bpmnworkflow library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gupalo / bpmnworkflow example snippets


    $walker = new ProcessWalker(new ExtensionHandler([
        new DiscountProcedure(),
        new WithoutDiscountProcedure(),
        new PriceFunction(),
        new LocaleFunction(),
        new EqValueComparison(),
        new LessValueComparison(),
        new MoreValueComparison(),
    ]));

    $loader = (new BpmnDirLoader(__DIR__ . '/../BpmnDiagrams')

    $cart = new Example\Cart\Cart(
        items: ['name' => 'cola', 'price' => 800],
        locale: 'en',
        price: 800,
    );
    $context = new DataContext($cart);

    $workflow = new Workflow($loader, $walker);
    $this->workflow->walk('cart_discount', $context);
bash
composer dump-autoload
php vendor/bin/phpunit vendor/gupalo/bpmnworkflow