Skip to content

Utility Commands

Commands for diagrams, discovery, and configuration.

eventflow diagram

Generate visualizations from flow files.

bash
# Generate default diagram
eventflow diagram order.flow

# Specific type
eventflow diagram order.flow --type=lane
eventflow diagram order.flow --type=state
eventflow diagram order.flow --type=combined

# Output format
eventflow diagram order.flow --format=svg
eventflow diagram order.flow --format=png
eventflow diagram order.flow --format=html
eventflow diagram order.flow --format=mermaid

# Output file
eventflow diagram order.flow --output=docs/diagrams/order.svg

# Specific scenario
eventflow diagram order.flow --scenario="successful checkout"

Options:

OptionDescription
--type=TYPEDiagram type: lane, state, combined
--format=FORMATOutput format: svg, png, html, mermaid
--output=FILEOutput file path
--scenario=NAMEGenerate for specific scenario
--darkUse dark theme

Output: Generating Diagram

$ eventflow diagram order.flow --type=lane --format=svg

EventFlow v1.0.0

Generating diagram...

  Flow:     order.flow
  Type:     Lane diagram
  Format:   SVG
  Scenario: All scenarios

  Analyzing flow...
    → 1 machine (@order)
    → 3 actors (@customer, @payment, @inventory)
    → 5 states
    → 8 transitions

  Rendering...
    → Layout: horizontal
    → Size: 1200x800px

────────────────────────────────────────
✓ Diagram generated

  Output: order-lane.svg (24.5 KB)

  Open in browser:
    file:///Users/dev/project/order-lane.svg

Output: Mermaid Format

$ eventflow diagram order.flow --format=mermaid

EventFlow v1.0.0

Generating Mermaid diagram...

────────────────────────────────────────

```mermaid
stateDiagram-v2
    [*] --> idle

    idle --> awaiting_payment : checkout
    awaiting_payment --> paid : payment_success
    awaiting_payment --> payment_failed : payment_failed
    payment_failed --> awaiting_payment : retry_checkout
    payment_failed --> cancelled : retry_limit_exceeded
    paid --> shipped : ship_order
    shipped --> delivered : confirm_delivery
    delivered --> [*]
    cancelled --> [*]

──────────────────────────────────────── ✓ Mermaid diagram generated

Copy the above to use in: → GitHub/GitLab markdown → Notion → Confluence → Any Mermaid-compatible tool


---

## `eventflow bindings:list`

List all discovered bindings.

```bash
# All bindings
eventflow bindings:list

# Filter by type
eventflow bindings:list --type=guard

# Show linked tests
eventflow bindings:list --with-tests

# JSON output
eventflow bindings:list --format=json

Output: With Tests

$ eventflow bindings:list --with-tests

EventFlow v1.0.0

Discovering bindings...

════════════════════════════════════════
DISCOVERED BINDINGS
════════════════════════════════════════

GUARDS (6)
────────────────────────────────────────

  'cart is not empty'
    Class:  App\Order\Guards\CartNotEmptyGuard
    File:   src/Order/Guards/CartNotEmptyGuard.php:12
    Tests:  ✓ CartNotEmptyGuardTest (3 tests)

  '@customer is logged in'
    Class:  App\Order\Guards\CustomerLoggedInGuard
    File:   src/Order/Guards/CustomerLoggedInGuard.php:10
    Tests:  ✓ CustomerLoggedInGuardTest (3 tests)

  '$retry_count is less than 3'
    Class:  App\Order\Guards\RetryLimitGuard
    File:   src/Order/Guards/RetryLimitGuard.php:8
    Tests:  ✓ RetryLimitGuardTest (5 tests)

  '@customer is admin'
    Class:  App\Order\Guards\CustomerIsAdminGuard
    File:   src/Order/Guards/CustomerIsAdminGuard.php:10
    Tests:  ✓ CustomerIsAdminGuardTest (3 tests)

  'payment is authorized'
    Class:  App\Order\Guards\PaymentAuthorizedGuard
    File:   src/Order/Guards/PaymentAuthorizedGuard.php:8
    Tests:  ⚠ None

  'order is in {state}'
    Class:  App\Order\Guards\OrderInStateGuard
    File:   src/Order/Guards/OrderInStateGuard.php:10
    Tests:  ✓ OrderInStateGuardTest (2 tests)

ACTIONS (4)
────────────────────────────────────────

  '$retry_count increases by 1'
    Class:  App\Order\Actions\IncrementRetryCountAction
    File:   src/Order/Actions/IncrementRetryCountAction.php:10
    Tests:  ✓ IncrementRetryCountActionTest (2 tests)

  'send confirmation email'
    Class:  App\Order\Actions\SendConfirmationEmailAction
    File:   src/Order/Actions/SendConfirmationEmailAction.php:12
    Tests:  ✓ SendConfirmationEmailActionTest (2 tests)

  'log payment attempt'
    Class:  App\Order\Actions\LogPaymentAttemptAction
    File:   src/Order/Actions/LogPaymentAttemptAction.php:8
    Tests:  ✓ LogPaymentAttemptActionTest (1 test)

  'notify customer'
    Class:  App\Order\Actions\NotifyCustomerAction
    File:   src/Order/Actions/NotifyCustomerAction.php:10
    Tests:  ⚠ None

EVENTS (3)
────────────────────────────────────────

  ':checkout'
    Class:  App\Order\Events\CheckoutEvent
    File:   src/Order/Events/CheckoutEvent.php:8
    Tests:  ✓ CheckoutEventTest (1 test)

  ':payment_request'
    Class:  App\Order\Events\PaymentRequestEvent
    File:   src/Order/Events/PaymentRequestEvent.php:8
    Tests:  ✓ PaymentRequestEventTest (2 tests)

  ':order_confirmed'
    Class:  App\Order\Events\OrderConfirmedEvent
    File:   src/Order/Events/OrderConfirmedEvent.php:8
    Tests:  ⚠ None

════════════════════════════════════════
SUMMARY
════════════════════════════════════════

  Total bindings: 13
    Guards:  6 (5 tested)
    Actions: 4 (3 tested)
    Events:  3 (2 tested)

  Test coverage: 10/13 bindings (77%)
  Total tests:   24 methods

  ⚠ Untested bindings:
    → PaymentAuthorizedGuard
    → NotifyCustomerAction
    → OrderConfirmedEvent

eventflow bindings:missing

List bindings required by a flow but not yet implemented.

bash
eventflow bindings:missing order.flow

Output: Missing Bindings

$ eventflow bindings:missing order.flow

EventFlow v1.0.0

Analyzing order.flow...

  Parsing flow file...
    → 1 machine: @order
    → 3 scenarios
    → 12 event handlers

  Scanning for required bindings...

════════════════════════════════════════
MISSING BINDINGS
════════════════════════════════════════

GUARDS (2 missing)
────────────────────────────────────────

  ✗ 'payment is authorized'
    Used in: order.flow:34
      ? payment is authorized
        emit :process_payment to @payment

    Create: eventflow make:guard "payment is authorized"

  ✗ 'inventory is available'
    Used in: order.flow:45
      ? inventory is available
        order moves to #ready_to_ship

    Create: eventflow make:guard "inventory is available"

ACTIONS (1 missing)
────────────────────────────────────────

  ✗ 'reserve inventory'
    Used in: order.flow:48
      reserve inventory

    Create: eventflow make:action "reserve inventory"

EVENTS (0 missing)
────────────────────────────────────────

  ✓ All events have handlers

════════════════════════════════════════
SUMMARY
════════════════════════════════════════

  Required bindings: 15
  Implemented:       12 (80%)
  Missing:            3

  To implement all missing bindings:

    eventflow make:guard "payment is authorized"
    eventflow make:guard "inventory is available"
    eventflow make:action "reserve inventory"

  Or create all at once:

    eventflow make:missing order.flow

eventflow init

Initialize EventFlow configuration.

bash
eventflow init

# With specific framework
eventflow init --framework=laravel
eventflow init --framework=symfony

Output: Initialization

$ eventflow init --framework=laravel

EventFlow v1.0.0

Initializing EventFlow for Laravel...

────────────────────────────────────────
CONFIGURATION
────────────────────────────────────────

Creating config/eventflow.php...

<?php

return [
    'bindings' => [
        'paths' => [
            'App\\EventFlow\\Guards',
            'App\\EventFlow\\Actions',
            'App\\EventFlow\\Events',
        ],
    ],

    'tests' => [
        'paths' => [
            'Tests\\EventFlow\\Guards',
            'Tests\\EventFlow\\Actions',
        ],
        'framework' => 'phpunit',
    ],

    'flows' => [
        'path' => resource_path('flows'),
    ],

    'links' => [
        'strict' => env('EVENTFLOW_STRICT_LINKS', false),
        'allow_placeholders' => true,
    ],
];

✓ Created

────────────────────────────────────────
DIRECTORIES
────────────────────────────────────────

Creating directories...
  ✓ app/EventFlow/Guards/
  ✓ app/EventFlow/Actions/
  ✓ app/EventFlow/Events/
  ✓ resources/flows/
  ✓ tests/EventFlow/Guards/
  ✓ tests/EventFlow/Actions/

────────────────────────────────────────
SERVICE PROVIDER
────────────────────────────────────────

Creating app/Providers/EventFlowServiceProvider.php...
  ✓ Created

Registering in config/app.php...
  ✓ Added to providers array

────────────────────────────────────────
✓ EventFlow initialized

Next steps:
  1. Create your first flow: resources/flows/order.flow
  2. Run: eventflow test resources/flows/order.flow
  3. Generate bindings: eventflow bindings:missing order.flow

eventflow config

Show or modify configuration.

bash
# Show current config
eventflow config

# Show specific key
eventflow config bindings.paths

# Set value
eventflow config links.strict true

Output: Show Config

$ eventflow config

EventFlow v1.0.0

Current Configuration
────────────────────────────────────────

Source: config/eventflow.php

bindings:
  paths:
    - App\EventFlow\Guards
    - App\EventFlow\Actions
    - App\EventFlow\Events

tests:
  paths:
    - Tests\EventFlow\Guards
    - Tests\EventFlow\Actions
  framework: phpunit

flows:
  path: resources/flows

links:
  strict: false
  allow_placeholders: true

Environment Overrides:
  EVENTFLOW_STRICT_LINKS: not set (default: false)

CI/CD Integration

GitHub Actions

yaml
name: EventFlow Tests

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.2'

      - name: Install dependencies
        run: composer install

      - name: Run flow tests
        run: eventflow test --format=junit > test-results.xml

      - name: Run binding tests
        run: eventflow test:bindings --format=junit >> test-results.xml

      - name: Validate test links
        run: eventflow links:validate --strict

      - name: Upload test results
        uses: actions/upload-artifact@v3
        if: always()
        with:
          name: test-results
          path: test-results.xml

      - name: Upload coverage
        uses: codecov/codecov-action@v3
        with:
          files: coverage.xml

GitLab CI

yaml
stages:
  - test
  - validate

eventflow:test:
  stage: test
  script:
    - eventflow test --format=junit > report.xml
    - eventflow test:bindings --format=junit >> report.xml
  artifacts:
    reports:
      junit: report.xml

eventflow:validate:
  stage: validate
  script:
    - eventflow links:validate --strict
  allow_failure: false

Released under the MIT License.