1. Go to this page and download the library: Download durable-workflow/workflow 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/ */
durable-workflow / workflow example snippets
use function Workflow\V2\activity;
use Workflow\V2\Workflow;
class MyWorkflow extends Workflow
{
public function handle(string $name): string
{
$result = activity(MyActivity::class, $name);
return $result;
}
}
use Workflow\V2\Activity;
class MyActivity extends Activity
{
public function handle(string $name): string
{
return "Hello, {$name}!";
}
}
use Workflow\V2\WorkflowStub;
$workflow = WorkflowStub::make(MyWorkflow::class);
$workflow->start('world');