# sunrise-php/vin architecture

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

- Interactive diagram: https://gitdiagram.com/sunrise-php/vin
- Repository: https://github.com/sunrise-php/vin

## Overview

This is a small PHP ISO-3779 VIN-decoding library. A caller constructs Vin with a VIN string; it uppercases and validates the input, splits WMI/VDS/VIS, determines region, country, manufacturer, and model-year candidates, then exposes the decoded values through getters, an array, or string conversion. The interface defines the getter contract. The excerpts show the decoder’s lookups into three data tables; no external service or persistent store is involved.

Main entry points: [`src/Vin.php`](https://github.com/sunrise-php/vin/blob/master/src/Vin.php) (VIN decoder), [`data/regions.php`](https://github.com/sunrise-php/vin/blob/master/data/regions.php) (Region data), [`data/manufacturers.php`](https://github.com/sunrise-php/vin/blob/master/data/manufacturers.php) (Manufacturer data), [`data/years.php`](https://github.com/sunrise-php/vin/blob/master/data/years.php) (Model-year data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_decode["VIN decoding"]
  node_decoder["VIN decoder<br/>[Vin.php]"]
end

subgraph group_reference["Code tables"]
  node_regions["Region data<br/>[regions.php]"]
  node_manufacturers["Manufacturer data<br/>[manufacturers.php]"]
  node_years["Model-year data<br/>[years.php]"]
end

subgraph group_api["Public API"]
  node_contract["Getter contract<br/>[VinInterface.php]"]
end

node_caller(("Library caller"))

node_caller -->|"constructs"| node_decoder
node_decoder -->|"looks up region/country"| node_regions
node_decoder -->|"looks up manufacturer"| node_manufacturers
node_decoder -->|"matches year code"| node_years
node_decoder -->|"implements"| node_contract

click node_decoder "https://github.com/sunrise-php/vin/blob/master/src/Vin.php"
click node_regions "https://github.com/sunrise-php/vin/blob/master/data/regions.php"
click node_manufacturers "https://github.com/sunrise-php/vin/blob/master/data/manufacturers.php"
click node_years "https://github.com/sunrise-php/vin/blob/master/data/years.php"
click node_contract "https://github.com/sunrise-php/vin/blob/master/src/VinInterface.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_decoder toneBlue
class node_regions,node_manufacturers,node_years toneAmber
class node_contract toneMint
class node_caller toneIndigo
```

## Components

### VIN decoding

- [VIN decoder](https://github.com/sunrise-php/vin/blob/master/src/Vin.php): `src/Vin.php`

### Code tables

- [Region data](https://github.com/sunrise-php/vin/blob/master/data/regions.php): `data/regions.php`
- [Manufacturer data](https://github.com/sunrise-php/vin/blob/master/data/manufacturers.php): `data/manufacturers.php`
- [Model-year data](https://github.com/sunrise-php/vin/blob/master/data/years.php): `data/years.php`

### Public API

- [Getter contract](https://github.com/sunrise-php/vin/blob/master/src/VinInterface.php): `src/VinInterface.php`

### Other components

- **Library caller**

## Connections

- Library caller → VIN decoder: constructs (evidence: `README.md`)
- VIN decoder → Region data: looks up region/country (evidence: `src/Vin.php`)
- VIN decoder → Manufacturer data: looks up manufacturer (evidence: `src/Vin.php`)
- VIN decoder → Model-year data: matches year code (evidence: `src/Vin.php`)
- VIN decoder → Getter contract: implements (evidence: `src/Vin.php`)
