@@ -14,32 +14,29 @@ Creates a new workflow builder instance.
1414$builder = WorkflowBuilder::create('my-workflow');
1515```
1616
17- #### ` step (string $id, string $actionClass): self`
17+ #### ` addStep (string $id, string $actionClass, array $config = [], ?int $timeout = null, int $retryAttempts = 0 ): self`
1818
1919Adds a custom action step to the workflow.
2020
2121``` php
22- $builder->step('process-payment', ProcessPaymentAction::class);
22+ $builder->addStep('process-payment', ProcessPaymentAction::class);
23+ $builder->addStep('process-payment', ProcessPaymentAction::class, ['currency' => 'USD'], 30, 3);
2324```
2425
25- #### ` email(string $template, array $options = []): self `
26+ #### ` email(string $template, string $to, string $subject, array $data = []): self `
2627
2728Adds an email step to the workflow.
2829
2930``` php
30- $builder->email('welcome-email', [
31- 'to' => '{{ user.email }}',
32- 'subject' => 'Welcome {{ user.name }}!',
33- 'data' => ['welcome_bonus' => 100]
34- ]);
31+ $builder->email('welcome-email', '{{ user.email }}', 'Welcome {{ user.name }}!', ['welcome_bonus' => 100]);
3532```
3633
37- #### ` http(string $method , string $url , array $data = []): self `
34+ #### ` http(string $url , string $method = 'GET' , array $data = [], array $headers = []): self `
3835
3936Adds an HTTP request step to the workflow.
4037
4138``` php
42- $builder->http('POST', ' https://api.example.com/webhooks', [
39+ $builder->http('https://api.example.com/webhooks', 'POST ', [
4340 'event' => 'user_registered',
4441 'user_id' => '{{ user.id }}'
4542]);
@@ -61,26 +58,24 @@ Adds conditional logic to the workflow.
6158
6259``` php
6360$builder->when('user.age >= 18', function($builder) {
64- $builder->step ('verify-identity', VerifyIdentityAction::class);
61+ $builder->addStep ('verify-identity', VerifyIdentityAction::class);
6562});
6663```
6764
68- #### ` retry( int $attempts, string $backoff = 'linear' ): self`
65+ #### ` startWith(string $actionClass, array $config = [], ? int $timeout = null, int $retryAttempts = 0 ): self`
6966
70- Configures retry behavior for the previous step .
67+ Adds the first step in a workflow (syntactic sugar for better readability) .
7168
7269``` php
73- $builder->step('api-call', ApiCallAction::class)
74- ->retry(attempts: 3, backoff: 'exponential');
70+ $builder->startWith(ValidateInputAction::class, ['strict' => true]);
7571```
7672
77- #### ` timeout(int $seconds = null, int $minutes = null, int $hours = null ): self`
73+ #### ` then(string $actionClass, array $config = [], ? int $timeout = null, int $retryAttempts = 0 ): self`
7874
79- Sets a timeout for the previous step .
75+ Adds a sequential step (syntactic sugar for better readability) .
8076
8177``` php
82- $builder->step('long-operation', LongOperationAction::class)
83- ->timeout(minutes: 5);
78+ $builder->then(ProcessDataAction::class)->then(SaveResultAction::class);
8479```
8580
8681#### ` build(): WorkflowDefinition `
0 commit comments