iammerus / flowy
Flowy - A PHP Workflow Engine
dev-main
2025-05-16 14:49 UTC
Requires
- php: >=8.1
- doctrine/dbal: ^4.2
- doctrine/orm: ^3.3
- psr/container: ^2.0
- psr/event-dispatcher: ^1.0
- ramsey/uuid: ^4.7
- symfony/cache: ^7.2
- symfony/console: ^7.2
- symfony/event-dispatcher: ^7.2
Requires (Dev)
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^12.1
- squizlabs/php_codesniffer: ^3.7
This package is auto-updated.
Last update: 2025-05-16 14:54:29 UTC
README
Flowy is a modern, extensible PHP workflow engine designed for robust, maintainable, and scalable workflow automation. Built with PHP 8.1+, it leverages modern language features, strict typing, and a modular architecture for maximum flexibility and developer experience.
🚀 Getting Started
Installation
Install Flowy via Composer:
composer require iammerus/flowy
Minimal Example: Define and Run a Workflow
use Flowy\Model\Data\WorkflowDefinition; use Flowy\Model\Data\StepDefinition; use Flowy\Registry\InMemoryDefinitionRegistry; use Flowy\Engine\WorkflowEngineService; use Flowy\Context\WorkflowContext; // 1. Define a workflow and its steps $step = new StepDefinition( 'start', [], [], 'Start', 'The initial step.', true, 'action', null, null ); $workflow = new WorkflowDefinition( 'demo_workflow', '1.0.0', 'start', [$step], 'Demo Workflow', 'A simple demo workflow.' ); // 2. Register the workflow definition $registry = new InMemoryDefinitionRegistry(); $registry->addDefinition($workflow); // 3. Create the engine (using in-memory persistence for demo) $engine = new WorkflowEngineService( $registry, /* PersistenceInterface */ new class implements \Flowy\Persistence\PersistenceInterface { public function save($instance) { /* ... */ } public function find($id) { /* ... */ } public function findByBusinessKey($defId, $key) { /* ... */ } public function findInstancesByStatus($status) { /* ... */ } }, /* EventDispatcherInterface */ new \Flowy\Event\NullEventDispatcher() ); // 4. Start a workflow instance $context = new WorkflowContext(['foo' => 'bar']); $instance = $engine->start('demo_workflow', '1.0.0', $context); echo "Started instance: " . $instance->id->toString() . PHP_EOL;
Running Tests, Static Analysis, and Code Style Checks
- Run tests:
composer test
- Run static analysis (PHPStan):
composer stan
- Check code style (PSR-12):
composer cs
📚 Further Documentation
- See docs/CoreConcepts.md for an overview of Flowy's core concepts.
Flowy is open-source and welcomes contributions! Please see the roadmap and specification before submitting PRs.