# nip24pl/nip24-php-client architecture

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

- Interactive diagram: https://gitdiagram.com/nip24pl/nip24-php-client
- Repository: https://github.com/nip24pl/nip24-php-client

## Overview

NIP24 Client for PHP combines local Polish/EU identifier validators with authenticated online company and tax-data lookups. A caller invokes the client API, which sends HTTP requests to NIP24 and parses responses into result models; the library also exposes validation, account, invoice, registry, VAT/VIES, whitelist, and IBAN capabilities. The sampled code confirms request/response handling and serializer behavior, but does not show every endpoint method, so those capability branches are grouped at the client level.

Main entry points: [`NIP24/NIP24Client.php`](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php) (NIP24 client), [`NIP24/ObjectSerializer.php`](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/ObjectSerializer.php) (Object serializer), [`NIP24`](https://github.com/nip24pl/nip24-php-client/tree/master/NIP24) (Number validators), [`NIP24/Model`](https://github.com/nip24pl/nip24-php-client/tree/master/NIP24/Model) (Lookup result models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_validation["Local validation"]
  node_validators["Number validators"]
end

subgraph group_api["NIP24 API"]
  node_client["NIP24 client<br/>[NIP24Client.php]"]
  node_lookup["Company lookups<br/>[NIP24Client.php]"]
  node_vat["VAT and VIES<br/>[NIP24Client.php]"]
  node_registry["KRS records<br/>[NIP24Client.php]"]
  node_iban["IBAN status<br/>[NIP24Client.php]"]
  node_whitelist["Whitelist status<br/>[NIP24Client.php]"]
  node_billing["Account and billing<br/>[NIP24Client.php]"]
end

subgraph group_models["Response models"]
  node_result_models["Lookup result models"]
  node_registry_models["KRS data models<br/>[KRSData.php]"]
  node_company_models["Company data models<br/>[AllData.php]"]
  node_vat_models["VAT entity models<br/>[VATEntity.php]"]
  node_billing_models["Billing models<br/>[BillingPlan.php]"]
end

subgraph group_serialization["Serialization"]
  node_serializer["Object serializer"]
  node_model_contract["Model contract<br/>[ModelInterface.php]"]
end

node_caller(("PHP application"))
node_service{{"NIP24 service"}}

node_caller -->|"validates locally"| node_validators
node_caller -->|"calls API"| node_client
node_client -->|"sends requests"| node_service
node_client -.->|"provides lookups"| node_lookup
node_client -.->|"provides checks"| node_vat
node_client -.->|"fetches records"| node_registry
node_client -.->|"checks status"| node_iban
node_client -.->|"checks status"| node_whitelist
node_client -.->|"exposes account"| node_billing
node_service -.->|"returns data"| node_result_models
node_client -->|"uses serializer"| node_serializer
node_serializer -->|"serializes models"| node_model_contract
node_client -.->|"parses KRS data"| node_registry_models
node_client -.->|"parses company data"| node_company_models
node_client -.->|"parses VAT data"| node_vat_models
node_client -.->|"uses billing data"| node_billing_models

click node_validators "https://github.com/nip24pl/nip24-php-client/tree/master/NIP24"
click node_client "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php"
click node_lookup "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php"
click node_vat "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php"
click node_registry "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php"
click node_iban "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php"
click node_whitelist "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php"
click node_billing "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php"
click node_result_models "https://github.com/nip24pl/nip24-php-client/tree/master/NIP24/Model"
click node_registry_models "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/Model/KRSData.php"
click node_company_models "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/Model/AllData.php"
click node_vat_models "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/Model/VATEntity.php"
click node_billing_models "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/Model/BillingPlan.php"
click node_serializer "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/ObjectSerializer.php"
click node_model_contract "https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/Model/ModelInterface.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_validators toneBlue
class node_client,node_lookup,node_vat,node_registry,node_iban,node_whitelist,node_billing toneAmber
class node_result_models,node_registry_models,node_company_models,node_vat_models,node_billing_models toneMint
class node_serializer,node_model_contract toneRose
class node_caller,node_service toneIndigo
```

## Components

### Local validation

- [Number validators](https://github.com/nip24pl/nip24-php-client/tree/master/NIP24): `NIP24`

### NIP24 API

- [NIP24 client](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php): `NIP24/NIP24Client.php`
- [Company lookups](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php): `NIP24/NIP24Client.php`
- [VAT and VIES](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php): `NIP24/NIP24Client.php`
- [KRS records](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php): `NIP24/NIP24Client.php`
- [IBAN status](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php): `NIP24/NIP24Client.php`
- [Whitelist status](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php): `NIP24/NIP24Client.php`
- [Account and billing](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/NIP24Client.php): `NIP24/NIP24Client.php`

### Response models

- [Lookup result models](https://github.com/nip24pl/nip24-php-client/tree/master/NIP24/Model): `NIP24/Model`
- [KRS data models](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/Model/KRSData.php): `NIP24/Model/KRSData.php`
- [Company data models](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/Model/AllData.php): `NIP24/Model/AllData.php`
- [VAT entity models](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/Model/VATEntity.php): `NIP24/Model/VATEntity.php`
- [Billing models](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/Model/BillingPlan.php): `NIP24/Model/BillingPlan.php`

### Serialization

- [Object serializer](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/ObjectSerializer.php): `NIP24/ObjectSerializer.php`
- [Model contract](https://github.com/nip24pl/nip24-php-client/blob/master/NIP24/Model/ModelInterface.php): `NIP24/Model/ModelInterface.php`

### Other components

- **PHP application**
- **NIP24 service**

## Connections

- PHP application → Number validators: validates locally
- PHP application → NIP24 client: calls API
- NIP24 client → NIP24 service: sends requests (evidence: `NIP24/NIP24Client.php`)
- NIP24 client → Company lookups: provides lookups (evidence: `NIP24/NIP24Client.php`)
- NIP24 client → VAT and VIES: provides checks (evidence: `NIP24/NIP24Client.php`)
- NIP24 client → KRS records: fetches records (evidence: `NIP24/NIP24Client.php`)
- NIP24 client → IBAN status: checks status (evidence: `NIP24/NIP24Client.php`)
- NIP24 client → Whitelist status: checks status (evidence: `NIP24/NIP24Client.php`)
- NIP24 client → Account and billing: exposes account (evidence: `NIP24/NIP24Client.php`)
- NIP24 service → Lookup result models: returns data
- NIP24 client → Object serializer: uses serializer (evidence: `NIP24/NIP24Client.php`)
- Object serializer → Model contract: serializes models (evidence: `NIP24/ObjectSerializer.php`)
- NIP24 client → KRS data models: parses KRS data (evidence: `NIP24/NIP24Client.php`)
- NIP24 client → Company data models: parses company data
- NIP24 client → VAT entity models: parses VAT data
- NIP24 client → Billing models: uses billing data
