adachsoft / workflow-symfony-cli
Symfony Console commands and formatters for workflow inspection, execution, validation and debugging.
Requires
- php: ^8.3
- adachsoft/collection: ^3.0
- adachsoft/symfony-console-io: ^0.1
- adachsoft/workflow: ^5.2
- symfony/console: ^7.3
Requires (Dev)
- adachsoft/php-code-style: ^0.7.1
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^12.4
- rector/rector: ^2.8
- symplify/phpstan-rules: ^14.19
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-10-29 09:14:04 UTC
README
Symfony Console commands and formatters for inspecting, validating, and debugging workflow definitions and runs.
Features
- List available workflow definitions from a repository.
- Display workflow details in human-readable text or JSON.
- Inspect workflow inputs, outputs, steps, branches, and step configuration.
- Render workflow graphs as colored two-dimensional text flowcharts, Mermaid, or JSON.
- Render workflow run summaries for CLI diagnostics.
- Extend step registration through a dedicated initializer contract.
Installation
composer require adachsoft/workflow-symfony-cli
Integration
Register AdachSoft\WorkflowSymfonyCli\Command\WorkflowListCommand in the Symfony Console application and provide its constructor dependencies through your service container:
AdachSoft\Workflow\Contracts\WorkflowDefinitionRepositoryInterfaceAdachSoft\Workflow\Contracts\StepRegistryInterfaceAdachSoft\Workflow\Registry\StepDefinitionResolver(fromadachsoft/workflow^5.2)AdachSoft\WorkflowSymfonyCli\Formatter\WorkflowDetailTextFormatterAdachSoft\WorkflowSymfonyCli\Formatter\WorkflowDetailJsonFormatter
The command is exposed as workflow:list.
The workflow detail view includes the declared workflow output schema. Text output uses the WORKFLOW OUTPUT SCHEMA section and displays [not declared] when no schema is declared. JSON output includes workflow_output_schema, with null representing an undeclared schema. Branch schemas are resolved from static step configuration; for run_workflow, the on_next schema reflects the child workflow's output_schema when config.workflow_id identifies the child statically. A child selected through config_map cannot be resolved this way. Ensure StepDefinitionResolver is available in the application service container.
Register AdachSoft\WorkflowSymfonyCli\Command\WorkflowGraphCommand as well. It is exposed as workflow:graph and requires the following services:
AdachSoft\Workflow\Contracts\WorkflowDefinitionRepositoryInterfaceAdachSoft\Workflow\Contracts\StepRegistryInterfaceAdachSoft\WorkflowSymfonyCli\Resolver\WorkflowGraphResolverAdachSoft\WorkflowSymfonyCli\Formatter\WorkflowGraphTextFormatterAdachSoft\WorkflowSymfonyCli\Formatter\WorkflowGraphMermaidFormatterAdachSoft\WorkflowSymfonyCli\Formatter\WorkflowGraphJsonFormatter
An AdachSoft\WorkflowSymfonyCli\Contract\StepRegistryInitializerInterface service is optional.
Usage
# List available workflows in text format.
php bin/console workflow:list
# List available workflows as JSON.
php bin/console workflow:list --format=json
# Display one workflow in text format.
php bin/console workflow:list --workflow-id=example
# Display one workflow as JSON.
php bin/console workflow:list --workflow-id=example --format=json
# Render a workflow graph as text (the default format).
php bin/console workflow:graph example
# Render a workflow graph as Mermaid.
php bin/console workflow:graph example --format=mermaid
# Render a workflow graph as JSON.
php bin/console workflow:graph example --format=json
The default text graph renders boxed steps, with green normal paths, red error paths, and yellow retry paths. Successful and failed terminal outcomes are marked with check and cross icons.
workflow:list returns a non-zero exit status when an unsupported output format is selected or the requested workflow cannot be loaded. workflow:graph returns a non-zero exit status when the format is unsupported or its workflow cannot be loaded.
Extending step registration
Implement AdachSoft\WorkflowSymfonyCli\Contract\StepRegistryInitializerInterface when the application needs to register workflow steps before CLI commands access the workflow registry.
use AdachSoft\Workflow\Contracts\StepRegistryInterface;
use AdachSoft\WorkflowSymfonyCli\Contract\StepRegistryInitializerInterface;
final class ApplicationStepRegistryInitializer implements StepRegistryInitializerInterface
{
public function initialize(StepRegistryInterface $stepRegistry): void
{
// Register application-specific workflow steps here.
}
}
Documentation examples
License
This library is released under the MIT license.