Skip to content

Commit fd09a17

Browse files
committed
workflow 3.0.10
1 parent c5cbda7 commit fd09a17

1 file changed

Lines changed: 47 additions & 2 deletions

File tree

packages/workflow.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,25 @@ echo $result->response('greet')->string();
5151
// Output: Hello, World!
5252
```
5353

54+
## Workflow Provider Convention
55+
56+
Implement `WorkflowProviderInterface` to expose a workflow definition from a class:
57+
58+
```php
59+
use Chevere\Workflow\Interfaces\WorkflowProviderInterface;
60+
use Chevere\Workflow\Interfaces\WorkflowInterface;
61+
62+
class MyProvider implements WorkflowProviderInterface
63+
{
64+
public static function workflow(): WorkflowInterface
65+
{
66+
return workflow(/* ... */);
67+
}
68+
}
69+
```
70+
71+
This is the recommended pattern for packages and applications. It separates workflow configuration from execution logic and enables discovery by tooling such as the **Chevere Workflow VSCode extension**.
72+
5473
## Core Concepts
5574

5675
Workflow is built around four main concepts:
@@ -447,8 +466,8 @@ Where:
447466

448467
* ***if* res(ja)**
449468
Job `jb` runs only if job `ja` response is truthy
450-
* ***ifNot* var(var) 1 true**
451-
Job `jb` runs only if `var` variable is not equal to `1` or `true`
469+
* ***ifNot* var(var)**
470+
Job `jb` runs only if `var` variable is not falsy
452471
* **j1->id @ j2(n:)**
453472
Job `j1` response key/property `id` is used as argument `n` for job `j2`
454473
* **j1->name @ j2(m:)**
@@ -773,6 +792,32 @@ class OrderProcessor
773792

774793
---
775794

795+
## Lint Mode
796+
797+
Set the `CHEVERE_WORKFLOW_LINT_ENABLE=1` environment variable to enable lint mode. In this mode both `Workflow` and `Job` collect parameter violations instead of throwing on errors, and generate a Mermaid graph on construction.
798+
799+
```sh
800+
CHEVERE_WORKFLOW_LINT_ENABLE=1 php my-workflow.php
801+
```
802+
803+
Call `$workflow->lint()` to get a JSON report with violations and the Mermaid diagram:
804+
805+
```php
806+
$workflow = workflow(
807+
step: sync(MyAction::class, value: variable('input'))
808+
);
809+
810+
$report = $workflow->lint();
811+
// {
812+
// "violations": [...],
813+
// "mermaid": "graph TB;\n ..."
814+
// }
815+
```
816+
817+
Lint mode is intended for development and CI pipelines to inspect workflow definitions without halting on the first error.
818+
819+
---
820+
776821
## Testing
777822

778823
### Testing Actions

0 commit comments

Comments
 (0)