adachsoft/workflow-definition-repository-json

JSON-based workflow definition repository (SPI) for adachsoft/workflow

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

pkg:composer/adachsoft/workflow-definition-repository-json

v0.1.1 2025-10-23 05:42 UTC

This package is not auto-updated.

Last update: 2025-10-23 03:44:51 UTC


README

A framework-agnostic JSON-based repository for workflow definitions compatible with AdachSoft Workflow SPI.

Package name: adachsoft/workflow-definition-repository-json

Installation

Require packages:

  • adachsoft/workflow ^0.4.2
  • adachsoft/collection ^2.4
  • adachsoft/filesystem ^1.1

Composer autoload:

{
  "autoload": { "psr-4": { "AdachSoft\\WorkflowDefinitionRepositoryJson\\": "src/" } }
}

Quick Start

use AdachSoft\FileSystem\PhysicalFileSystem;
use AdachSoft\WorkflowDefinitionRepositoryJson\PublicApi\Config\JsonRepositoryConfig;
use AdachSoft\WorkflowDefinitionRepositoryJson\Provider\WorkflowDefinition\JsonFilesystemWorkflowDefinitionRepository;
use AdachSoft\WorkflowDefinitionRepositoryJson\Provider\WorkflowDefinition\Mapper\JsonToSpiWorkflowDefinitionMapperDefault;
use AdachSoft\WorkflowDefinitionRepositoryJson\Provider\WorkflowDefinition\Validator\WorkflowJsonRuntimeValidatorDefault;
use AdachSoft\Workflow\PublicApi\Builder\WorkflowModuleBuilderDefault;

$fs = new PhysicalFileSystem(__DIR__);
$config = new JsonRepositoryConfig(baseDir: __DIR__ . '/workflows', fileExtension: '.json', prettyPrint: true);
$mapper = new JsonToSpiWorkflowDefinitionMapperDefault();
$validator = new WorkflowJsonRuntimeValidatorDefault();

$repo = new JsonFilesystemWorkflowDefinitionRepository($fs, $mapper, $validator, $config);

$facade = WorkflowModuleBuilderDefault::create()
    ->withDefinitionRepositorySpi($repo)
    ->build();

Or use the factory:

use AdachSoft\WorkflowDefinitionRepositoryJson\PublicApi\Factory\WorkflowSpiJsonRepositoryFactory as Factory;
$repo = Factory::createWithPhysicalFs(__DIR__);

Development

  • Run tests: composer test
  • Run tests with coverage: composer test-coverage
  • Static analysis: composer stan
  • CS check: composer cs
  • CS fix: composer cs-fix

Compatibility

  • This package is compatible with adachsoft/workflow v0.4.2.

See docs/JSON_FORMAT.md for JSON schema details.