Skip to content

Commit 6641a2b

Browse files
committed
wip: restructure
1 parent 67eaad5 commit 6641a2b

File tree

82 files changed

+2842
-661
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+2842
-661
lines changed

composer.json

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
2-
"name": "solution-forest/workflow-mastery",
3-
"description": "A powerful, framework-agnostic workflow engine for PHP with Laravel integration - enabling complex business process automation with state management, parallel execution, and extensible action system.",
2+
"name": "solution-forest/workflow-engine-laravel",
3+
"description": "Laravel integration for the Workflow Engine - providing Eloquent models, service providers, and artisan commands for seamless workflow management",
44
"keywords": [
55
"solutionforest",
66
"laravel",
7-
"workflow-mastery",
87
"workflow-engine",
8+
"workflow-laravel",
99
"business-process",
1010
"automation",
1111
"orchestration",
12-
"state-machine"
12+
"state-machine",
13+
"laravel-package"
1314
],
14-
"homepage": "https://github.com/solution-forest/workflow-mastery",
15+
"homepage": "https://github.com/solution-forest/workflow-engine-laravel",
1516
"license": "MIT",
1617
"authors": [
1718
{
@@ -21,7 +22,8 @@
2122
}
2223
],
2324
"require": {
24-
"php": "^8.3",
25+
"php": "^8.1",
26+
"solution-forest/workflow-engine-core": "*",
2527
"spatie/laravel-package-tools": "^1.16",
2628
"illuminate/contracts": "^10.0||^11.0||^12.0",
2729
"illuminate/support": "^10.0||^11.0||^12.0",
@@ -46,19 +48,21 @@
4648
},
4749
"autoload": {
4850
"psr-4": {
49-
"SolutionForest\\WorkflowMastery\\": "src/",
50-
"SolutionForest\\WorkflowMastery\\Database\\Factories\\": "database/factories/"
51-
},
52-
"files": [
53-
"src/helpers.php"
54-
]
51+
"SolutionForest\\WorkflowEngine\\Laravel\\": "src/"
52+
}
5553
},
5654
"autoload-dev": {
5755
"psr-4": {
58-
"SolutionForest\\WorkflowMastery\\Tests\\": "tests/",
56+
"SolutionForest\\WorkflowEngine\\Laravel\\Tests\\": "tests/",
5957
"Workbench\\App\\": "workbench/app/"
6058
}
6159
},
60+
"repositories": [
61+
{
62+
"type": "path",
63+
"url": "./packages/workflow-engine-core"
64+
}
65+
],
6266
"scripts": {
6367
"post-autoload-dump": "@composer run prepare",
6468
"prepare": "@php vendor/bin/testbench package:discover --ansi",
@@ -77,10 +81,10 @@
7781
"extra": {
7882
"laravel": {
7983
"providers": [
80-
"SolutionForest\\WorkflowMastery\\LaravelWorkflowEngineServiceProvider"
84+
"SolutionForest\\WorkflowEngine\\Laravel\\Providers\\WorkflowEngineServiceProvider"
8185
],
8286
"aliases": {
83-
"WorkflowMastery": "SolutionForest\\WorkflowMastery\\Facades\\WorkflowMastery"
87+
"WorkflowEngine": "SolutionForest\\WorkflowEngine\\Laravel\\Facades\\WorkflowEngine"
8488
}
8589
}
8690
},

config/workflow-mastery.php

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "solution-forest/workflow-engine-core",
3+
"description": "Framework-agnostic workflow engine for PHP applications",
4+
"type": "library",
5+
"license": "MIT",
6+
"keywords": [
7+
"workflow",
8+
"state-machine",
9+
"business-process",
10+
"automation",
11+
"php"
12+
],
13+
"authors": [
14+
{
15+
"name": "Solution Forest",
16+
"email": "info@solutionforest.com"
17+
}
18+
],
19+
"require": {
20+
"php": "^8.1",
21+
"nesbot/carbon": "^2.0|^3.0"
22+
},
23+
"require-dev": {
24+
"phpunit/phpunit": "^10.0",
25+
"phpstan/phpstan": "^1.10",
26+
"pestphp/pest": "^2.0"
27+
},
28+
"autoload": {
29+
"psr-4": {
30+
"SolutionForest\\WorkflowEngine\\": "src/"
31+
},
32+
"files": [
33+
"src/helpers.php"
34+
]
35+
},
36+
"autoload-dev": {
37+
"psr-4": {
38+
"SolutionForest\\WorkflowEngine\\Tests\\": "tests/"
39+
}
40+
},
41+
"minimum-stability": "stable",
42+
"prefer-stable": true,
43+
"config": {
44+
"sort-packages": true,
45+
"allow-plugins": {
46+
"pestphp/pest-plugin": true
47+
}
48+
}
49+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
level: 5
6+
paths:
7+
- src
8+
- config
9+
- database
10+
tmpDir: build/phpstan
11+
checkOctaneCompatibility: true
12+
checkModelProperties: true
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
5+
backupGlobals="false"
6+
bootstrap="vendor/autoload.php"
7+
colors="true"
8+
processIsolation="false"
9+
stopOnFailure="false"
10+
executionOrder="random"
11+
failOnWarning="true"
12+
failOnRisky="true"
13+
failOnEmptyTestSuite="true"
14+
beStrictAboutOutputDuringTests="true"
15+
cacheDirectory=".phpunit.cache"
16+
backupStaticProperties="false"
17+
>
18+
<testsuites>
19+
<testsuite name="Solutionforest Test Suite">
20+
<directory>tests</directory>
21+
</testsuite>
22+
</testsuites>
23+
<logging>
24+
<junit outputFile="build/report.junit.xml"/>
25+
</logging>
26+
<source>
27+
<include>
28+
<directory suffix=".php">./src</directory>
29+
</include>
30+
</source>
31+
</phpunit>

src/Actions/BaseAction.php renamed to packages/workflow-engine-core/src/Actions/BaseAction.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

3-
namespace SolutionForest\WorkflowMastery\Actions;
3+
namespace SolutionForest\WorkflowEngine\Actions;
44

55
use Illuminate\Support\Facades\Log;
6-
use SolutionForest\WorkflowMastery\Contracts\WorkflowAction;
7-
use SolutionForest\WorkflowMastery\Core\ActionResult;
8-
use SolutionForest\WorkflowMastery\Core\WorkflowContext;
9-
use SolutionForest\WorkflowMastery\Exceptions\StepExecutionException;
6+
use SolutionForest\WorkflowEngine\Contracts\WorkflowAction;
7+
use SolutionForest\WorkflowEngine\Core\ActionResult;
8+
use SolutionForest\WorkflowEngine\Core\WorkflowContext;
9+
use SolutionForest\WorkflowEngine\Exceptions\StepExecutionException;
1010

1111
/**
1212
* Base implementation for workflow actions with common functionality.

src/Actions/ConditionAction.php renamed to packages/workflow-engine-core/src/Actions/ConditionAction.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
namespace SolutionForest\WorkflowMastery\Actions;
3+
namespace SolutionForest\WorkflowEngine\Actions;
44

5-
use SolutionForest\WorkflowMastery\Attributes\Condition;
6-
use SolutionForest\WorkflowMastery\Attributes\WorkflowStep;
7-
use SolutionForest\WorkflowMastery\Core\ActionResult;
8-
use SolutionForest\WorkflowMastery\Core\WorkflowContext;
5+
use SolutionForest\WorkflowEngine\Attributes\Condition;
6+
use SolutionForest\WorkflowEngine\Attributes\WorkflowStep;
7+
use SolutionForest\WorkflowEngine\Core\ActionResult;
8+
use SolutionForest\WorkflowEngine\Core\WorkflowContext;
99

1010
/**
1111
* Condition evaluation action with advanced expression parsing

src/Actions/DelayAction.php renamed to packages/workflow-engine-core/src/Actions/DelayAction.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

3-
namespace SolutionForest\WorkflowMastery\Actions;
3+
namespace SolutionForest\WorkflowEngine\Actions;
44

5-
use SolutionForest\WorkflowMastery\Core\ActionResult;
6-
use SolutionForest\WorkflowMastery\Core\WorkflowContext;
5+
use SolutionForest\WorkflowEngine\Core\ActionResult;
6+
use SolutionForest\WorkflowEngine\Core\WorkflowContext;
77

88
/**
99
* A delay action that can be used to pause workflow execution

src/Actions/HttpAction.php renamed to packages/workflow-engine-core/src/Actions/HttpAction.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace SolutionForest\WorkflowMastery\Actions;
3+
namespace SolutionForest\WorkflowEngine\Actions;
44

55
use Illuminate\Support\Facades\Http;
6-
use SolutionForest\WorkflowMastery\Attributes\Retry;
7-
use SolutionForest\WorkflowMastery\Attributes\Timeout;
8-
use SolutionForest\WorkflowMastery\Attributes\WorkflowStep;
9-
use SolutionForest\WorkflowMastery\Core\ActionResult;
10-
use SolutionForest\WorkflowMastery\Core\WorkflowContext;
6+
use SolutionForest\WorkflowEngine\Attributes\Retry;
7+
use SolutionForest\WorkflowEngine\Attributes\Timeout;
8+
use SolutionForest\WorkflowEngine\Attributes\WorkflowStep;
9+
use SolutionForest\WorkflowEngine\Core\ActionResult;
10+
use SolutionForest\WorkflowEngine\Core\WorkflowContext;
1111

1212
/**
1313
* HTTP request action with PHP 8.3+ features

0 commit comments

Comments
 (0)