Skip to main content

Architecture

These pages show how Behat Steps works inside. Read them when you write a trait, extend the library or want to know why a step behaves the way it does. Writing scenarios needs none of them. The section holds the following pages:

An AI agent maintains these pages and their diagrams through the update-architecture-docs skill in .claude/skills/update-architecture-docs/SKILL.md. The agent draws the diagrams with the drawio-skill. Everything here is traced from the source code, and where the pages and the code disagree, the code wins.

To look something up, use the references:

Diagram sources​

Each diagram has a draw.io source and 2 exported SVGs, 1 for the light color mode and 1 for the dark. The diagram's page embeds both, and the site shows the SVG that matches the color mode. All 3 files are committed, so a reviewer sees the source diff and the rendered result. The following table lists every diagram of this section:

DiagramPageSourceRenders
Logical architectureLogical architecturelogical-architecture.drawiolight, dark
Backend selectionBackend layerbackend-selection.drawiolight, dark
Extension layerExtension layerextension-layer.drawiolight, dark
Steps layerSteps layersteps-layer.drawiolight, dark
Data flowData flowdata-flow.drawiolight, dark
Class inheritanceClass inheritanceclass-inheritance.drawiolight, dark

The 3 diagrams of the HTTP clients guide sit beside the guide in docs/content/guides/, drawn and checked the same way.

To change a diagram by hand:

  1. Open its source in draw.io, edit it and save it.

  2. From the repository root, export every SVG again:

    php scripts/draw-diagram.php --export \
    docs/content/architecture docs/content/guides

Each SVG records the hash of the source it came from. php scripts/draw-diagram.php --check docs/content/architecture docs/content/guides exits with an error when an SVG was exported from an older source or a diagram lacks either of its SVGs. The unit suite runs the same check.

After a structural change, ask the AI agent to "update architecture docs". Structural changes include a new layer, namespace, backend or capability. A change to an inheritance tree or the scenario lifecycle counts too. The agent re-traces the affected diagrams and pages from the current code and redraws them through the update-architecture-docs skill.