1. Go to this page and download the library: Download serverlessworkflow/sdk 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/ */
serverlessworkflow / sdk example snippets
use Serverless\Workflow\Action;
use Serverless\Workflow\ActionDataFilter;
use Serverless\Workflow\FunctionDef;
use Serverless\Workflow\FunctionRef;
use Serverless\Workflow\OperationState;
use Serverless\Workflow\Workflow;
$workflow = new Workflow([
'id' => 'greeting',
'name' => 'Greeting Workflow',
'description' => 'Greet Someone',
'version' => '1.0',
'specVersion' => '0.8',
'start' => 'Greet',
'states' => [
new OperationState([
'name' => 'Greet',
'type' => 'operation',
'actions' => [
new Action([
'functionRef' => new FunctionRef([
'refName' => 'greetingFunction',
'arguments' => [
'name' => '${ .person.name }',
],
]),
'actionDataFilter' => new ActionDataFilter([
'results' => '${ .greeting }',
]),
]),
],
'end' => true,
]),
],
'functions' => [
new FunctionDef([
'name' => 'greetingFunction',
'operation' => 'file://myapis/greetingapis.json#greeting',
]),
],
]);