@@ -129,7 +129,9 @@ $workflow = WorkflowBuilder::quick()->documentApproval();
129129
130130### PHP 8.3+ Attributes
131131
132- Use native PHP attributes to configure actions with retry, timeout, and conditions:
132+ > ** Note:** Attributes are currently metadata annotations for documentation and tooling. They are not yet auto-parsed by the engine at runtime — use the builder API (` timeout: ` , ` retryAttempts: ` , ` when() ` ) or step config to apply these behaviors. Attribute-driven execution is planned for a future release.
133+
134+ Use native PHP attributes to annotate actions with retry, timeout, and conditions:
133135
134136#### Retry Logic
135137``` php
@@ -214,14 +216,57 @@ $workflow = WorkflowBuilder::create('conditional-flow')
214216### Workflow Lifecycle Management
215217
216218``` php
217- // Start, pause, resume, cancel
219+ // Start, resume, cancel
218220$instanceId = $engine->start('my-workflow', $definition->toArray(), ['key' => 'value']);
219221$instance = $engine->getInstance($instanceId);
222+ $engine->resume($instanceId);
220223$engine->cancel($instanceId, 'No longer needed');
221224
222- // Query instances
223- $instances = $engine->getInstances(['state' => 'running']);
224- $status = $engine->getStatus('my-workflow');
225+ // Track progress
226+ $progress = $instance->getProgress(); // 0.0 to 100.0
227+ $summary = $instance->getStatusSummary();
228+
229+ // Query instances with filters
230+ $instances = $engine->getInstances([
231+ 'state' => 'running',
232+ 'definition_name' => 'order-processing',
233+ 'created_after' => new \DateTime('-7 days'),
234+ 'limit' => 50,
235+ 'offset' => 0,
236+ ]);
237+ ```
238+
239+ ### SimpleWorkflow Helper
240+
241+ For quick workflow execution without manual engine setup:
242+
243+ ``` php
244+ use SolutionForest\WorkflowEngine\Support\SimpleWorkflow;
245+
246+ $simple = new SimpleWorkflow($storageAdapter);
247+
248+ // Run actions sequentially
249+ $instanceId = $simple->sequential('user-onboarding', [
250+ SendWelcomeEmailAction::class,
251+ CreateUserProfileAction::class,
252+ AssignDefaultRoleAction::class,
253+ ], ['user_id' => 123]);
254+
255+ // Run a single action as a workflow
256+ $instanceId = $simple->runAction(SendEmailAction::class, [
257+ 'to' => 'user@example.com',
258+ 'subject' => 'Welcome!',
259+ ]);
260+
261+ // Execute from a builder
262+ $builder = WorkflowBuilder::create('custom-flow')
263+ ->addStep('validate', ValidateAction::class)
264+ ->addStep('process', ProcessAction::class);
265+ $instanceId = $simple->executeBuilder($builder, $context);
266+
267+ // Check status
268+ $status = $simple->getStatus($instanceId);
269+ // Returns: id, state, current_step, progress, completed_steps, failed_steps, error_message, ...
225270```
226271
227272## 🏗️ Architecture
@@ -280,6 +325,37 @@ State transitions are validated at runtime — invalid transitions throw `Invali
280325| ` Exceptions\ ` | WorkflowException, InvalidWorkflowDefinitionException, InvalidWorkflowStateException, ActionNotFoundException, StepExecutionException, WorkflowInstanceNotFoundException |
281326| ` Support\ ` | NullLogger, NullEventDispatcher, SimpleWorkflow, Uuid, Timeout, ConditionEvaluator, Arr |
282327
328+ ### Built-in Actions
329+
330+ Six ready-to-use actions are included:
331+
332+ | Action | Purpose | Config Keys |
333+ | --------| ---------| -------------|
334+ | ** LogAction** | Log messages with placeholder replacement (` {user.name} ` ) | ` message ` , ` level ` (debug/info/warning/error) |
335+ | ** EmailAction** | Mock email sending with template support | ` to ` , ` subject ` , ` body ` , ` template ` |
336+ | ** HttpAction** | HTTP requests with ` {{ variable }} ` template variables | ` url ` , ` method ` , ` headers ` , ` body ` |
337+ | ** DelayAction** | Pause execution for a specified duration | ` seconds ` , ` minutes ` , ` hours ` |
338+ | ** ConditionAction** | Evaluate boolean expressions and branch (` on_true ` /` on_false ` ) | ` condition ` , ` on_true ` , ` on_false ` |
339+ | ** BaseAction** | Abstract base class for custom actions | — |
340+
341+ ### WorkflowState Helpers
342+
343+ The ` WorkflowState ` enum provides utility methods for UI and logic:
344+
345+ ``` php
346+ $state = $instance->getState();
347+
348+ $state->isActive(); // true for PENDING, RUNNING, WAITING, PAUSED
349+ $state->isFinished(); // true for COMPLETED, FAILED, CANCELLED
350+ $state->isSuccessful(); // true for COMPLETED
351+ $state->isError(); // true for FAILED
352+ $state->label(); // "Running"
353+ $state->description(); // "The workflow is actively executing steps..."
354+ $state->color(); // "blue" (gray, blue, yellow, orange, green, red, purple)
355+ $state->icon(); // "▶️"
356+ $state->canTransitionTo(WorkflowState::COMPLETED); // bool
357+ $state->getValidTransitions(); // [WorkflowState::WAITING, ...]
358+ ```
283359
284360## 🔧 Configuration
285361
@@ -436,7 +512,6 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
436512
437513## 🔗 Links
438514
439- - [ Documentation] ( https://github.com/solution-forest/workflow-engine-core/docs )
440- - [ Issues] ( https://github.com/solution-forest/workflow-engine-core/issues )
441- - [ Changelog] ( https://github.com/solution-forest/workflow-engine-core/blob/main/CHANGELOG.md )
442- - [ Laravel Integration] ( https://github.com/solution-forest/workflow-engine-laravel )
515+ - [ Issues] ( https://github.com/solutionforest/workflow-engine-core/issues )
516+ - [ Changelog] ( https://github.com/solutionforest/workflow-engine-core/blob/main/CHANGELOG.md )
517+ - [ Laravel Integration] ( https://github.com/solutionforest/workflow-engine-laravel )
0 commit comments