PHP code example of johnnymast / logichain
1. Go to this page and download the library: Download johnnymast/logichain 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/ */
johnnymast / logichain example snippets
use JohnnyMast\LogicChain\Workflow;
use Examples\Invokables\ValidateOrder;
use Examples\Invokables\CreateOrder;
use Examples\Invokables\StoreOrder;
use Examples\Invokables\SendOrderEmail;
$workflow = (new Workflow())
->add(new ValidateOrder())
->add(new CreateOrder())
->add(new StoreOrder())
->add(new SendOrderEmail())
->success(fn($r) => print "Order completed\n")
->failed(fn($r) => print "Order failed: {$r->context->error}\n");
$result = $workflow->run([
'customer' => '[email protected]',
'items' => ['sku-123', 'sku-456'],
]);
JohnnyMast\LogicChain