承接 iammerus/flowy 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

iammerus/flowy

Composer 安装命令:

composer require iammerus/flowy

包简介

Flowy - A PHP Workflow Engine

README 文档

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

Flowy is open-source and welcomes contributions! Please see the roadmap and specification before submitting PRs.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-16