|
| 1 | +# Workflow Engine Core |
| 2 | + |
| 3 | +A framework-agnostic workflow engine for PHP applications. This is the core library that provides workflow definition, execution, and state management without any framework dependencies. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Framework Agnostic**: Works with any PHP framework or standalone |
| 8 | +- **Type Safe**: Full PHP 8.1+ type safety with strict typing |
| 9 | +- **Extensible**: Plugin architecture for custom actions and storage adapters |
| 10 | +- **State Management**: Robust workflow instance state tracking |
| 11 | +- **Error Handling**: Comprehensive exception handling with context |
| 12 | +- **Performance**: Optimized for high-throughput workflow execution |
| 13 | + |
| 14 | +## Installation |
| 15 | + |
| 16 | +```bash |
| 17 | +composer require solution-forest/workflow-engine-core |
| 18 | +``` |
| 19 | + |
| 20 | +## Quick Start |
| 21 | + |
| 22 | +```php |
| 23 | +use SolutionForest\WorkflowEngine\Core\WorkflowBuilder; |
| 24 | +use SolutionForest\WorkflowEngine\Core\WorkflowEngine; |
| 25 | +use SolutionForest\WorkflowEngine\Core\WorkflowContext; |
| 26 | + |
| 27 | +// Define a workflow |
| 28 | +$workflow = WorkflowBuilder::create('order-processing') |
| 29 | + ->addStep('validate', ValidateOrderAction::class) |
| 30 | + ->addStep('payment', ProcessPaymentAction::class) |
| 31 | + ->addStep('fulfillment', FulfillOrderAction::class) |
| 32 | + ->addTransition('validate', 'payment') |
| 33 | + ->addTransition('payment', 'fulfillment') |
| 34 | + ->build(); |
| 35 | + |
| 36 | +// Create execution context |
| 37 | +$context = new WorkflowContext( |
| 38 | + workflowId: 'order-processing', |
| 39 | + stepId: 'validate', |
| 40 | + data: ['order_id' => 123, 'customer_id' => 456] |
| 41 | +); |
| 42 | + |
| 43 | +// Execute workflow |
| 44 | +$engine = new WorkflowEngine(); |
| 45 | +$instance = $engine->start($workflow, $context); |
| 46 | +$result = $engine->executeStep($instance, $context); |
| 47 | +``` |
| 48 | + |
| 49 | +## Laravel Integration |
| 50 | + |
| 51 | +For Laravel applications, use the Laravel integration package: |
| 52 | + |
| 53 | +```bash |
| 54 | +composer require solution-forest/workflow-engine-laravel |
| 55 | +``` |
| 56 | + |
| 57 | +## Documentation |
| 58 | + |
| 59 | +- [Getting Started](docs/getting-started.md) |
| 60 | +- [API Reference](docs/api-reference.md) |
| 61 | +- [Advanced Features](docs/advanced-features.md) |
| 62 | + |
| 63 | +## License |
| 64 | + |
| 65 | +MIT License. See [LICENSE](LICENSE) for details. |
0 commit comments