# vouchedfor/tokenbundle architecture

> Architecture diagram of the GitHub repository vouchedfor/tokenbundle, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vouchedfor/tokenbundle
- Repository: https://github.com/vouchedfor/tokenbundle

## Overview

This Symfony bundle exposes an external token encode/decode service: an application configures its endpoint, the bundle extension validates and loads configuration, and TokenEncoder sends encode and decode HTTP requests. The README documents bundle registration and endpoint configuration; the excerpts show configuration processing and the cURL calls. The services file exists in the tree but was not sampled, so its wiring to TokenEncoder is shown as unverified.

Main entry points: [`DependencyInjection/VouchedForTokenExtension.php`](https://github.com/vouchedfor/tokenbundle/blob/master/DependencyInjection/VouchedForTokenExtension.php) (Container extension), [`Resources/config/services.yml`](https://github.com/vouchedfor/tokenbundle/blob/master/Resources/config/services.yml) (Service definitions), [`Encoder/TokenEncoder.php`](https://github.com/vouchedfor/tokenbundle/blob/master/Encoder/TokenEncoder.php) (Token encoder), [`VouchedForTokenBundle.php`](https://github.com/vouchedfor/tokenbundle/blob/master/VouchedForTokenBundle.php) (Bundle registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bundle["Symfony Bundle"]
  node_bundle["Bundle registration"]
  node_service_yaml["Service definitions<br/>[services.yml]"]
end

subgraph group_config["Configuration"]
  node_extension["Container extension"]
  node_configuration["Config schema<br/>[Configuration.php]"]
end

subgraph group_tokens["Token Exchange"]
  node_encoder["Token encoder<br/>[TokenEncoder.php]"]
end

node_application(("Host application"))
node_token_api["Token endpoint"]

node_application -->|"registers"| node_bundle
node_application -->|"configures URL"| node_extension
node_extension -->|"processes config"| node_configuration
node_extension -->|"loads services"| node_service_yaml
node_service_yaml -.->|"registers"| node_encoder
node_encoder -->|"HTTP encode/decode"| node_token_api

click node_bundle "https://github.com/vouchedfor/tokenbundle/blob/master/VouchedForTokenBundle.php"
click node_extension "https://github.com/vouchedfor/tokenbundle/blob/master/DependencyInjection/VouchedForTokenExtension.php"
click node_configuration "https://github.com/vouchedfor/tokenbundle/blob/master/DependencyInjection/Configuration.php"
click node_service_yaml "https://github.com/vouchedfor/tokenbundle/blob/master/Resources/config/services.yml"
click node_encoder "https://github.com/vouchedfor/tokenbundle/blob/master/Encoder/TokenEncoder.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bundle,node_service_yaml toneBlue
class node_extension,node_configuration toneAmber
class node_encoder toneMint
class node_application,node_token_api toneIndigo
```

## Components

### Symfony Bundle

- [Bundle registration](https://github.com/vouchedfor/tokenbundle/blob/master/VouchedForTokenBundle.php): `VouchedForTokenBundle.php`
- [Service definitions](https://github.com/vouchedfor/tokenbundle/blob/master/Resources/config/services.yml): `Resources/config/services.yml`

### Configuration

- [Container extension](https://github.com/vouchedfor/tokenbundle/blob/master/DependencyInjection/VouchedForTokenExtension.php): `DependencyInjection/VouchedForTokenExtension.php`
- [Config schema](https://github.com/vouchedfor/tokenbundle/blob/master/DependencyInjection/Configuration.php): `DependencyInjection/Configuration.php`

### Token Exchange

- [Token encoder](https://github.com/vouchedfor/tokenbundle/blob/master/Encoder/TokenEncoder.php): `Encoder/TokenEncoder.php`

### Other components

- **Host application**
- **Token endpoint**

## Connections

- Host application → Bundle registration: registers (evidence: `README.md`)
- Host application → Container extension: configures URL (evidence: `README.md`)
- Container extension → Config schema: processes config (evidence: `DependencyInjection/VouchedForTokenExtension.php`)
- Container extension → Service definitions: loads services (evidence: `DependencyInjection/VouchedForTokenExtension.php`)
- Service definitions → Token encoder: registers
- Token encoder → Token endpoint: HTTP encode/decode (evidence: `Encoder/TokenEncoder.php`)
