# dana-id/dana-php architecture

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

- Interactive diagram: https://gitdiagram.com/dana-id/dana-php
- Repository: https://github.com/dana-id/dana-php

## Overview

dana-php is the official PHP SDK for DANA’s REST APIs. An integrating application configures the SDK and invokes an API client; the client sends requests to DANA and returns typed responses or errors. The product also supports merchant management, widget flows, disbursement operations, and webhook verification/parsing. Shared model and serialization code underpins the API payloads. API-client internals beyond the sampled Disbursement client were not inspected, so their detailed calls to shared helpers are not asserted.

Main entry points: [`lib/Disbursement/v1/Api/DisbursementApi.php`](https://github.com/dana-id/dana-php/blob/main/lib/Disbursement/v1/Api/DisbursementApi.php) (Disbursement API), [`lib/Model/BaseModel.php`](https://github.com/dana-id/dana-php/blob/main/lib/Model/BaseModel.php) (Base Model), [`lib/Webhook/v1/WebhookParser.php`](https://github.com/dana-id/dana-php/blob/main/lib/Webhook/v1/WebhookParser.php) (Webhook Parser), [`lib/PaymentGateway/v1/Api/PaymentGatewayApi.php`](https://github.com/dana-id/dana-php/blob/main/lib/PaymentGateway/v1/Api/PaymentGatewayApi.php) (Payment Gateway API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_payments["Payments and Widgets"]
  node_payment_api["Payment Gateway API"]
  node_payment_models["Payment Models"]
  node_widget_api["Widget API<br/>[WidgetApi.php]"]
  node_widget_models["Widget Models"]
end

subgraph group_operations["Merchant and Disbursement"]
  node_disbursement_api["Disbursement API"]
  node_disbursement_models["Disbursement Models"]
  node_merchant_api["Merchant API"]
  node_merchant_models["Merchant Models"]
end

subgraph group_shared["SDK Infrastructure"]
  node_configuration["Configuration<br/>[Configuration.php]"]
  node_snap_headers["SNAP Headers<br/>[SnapHeader.php]"]
  node_api_errors["API Exceptions<br/>[ApiException.php]"]
  node_base_model["Base Model<br/>[BaseModel.php]"]
  node_model_interface["Model Interface<br/>[ModelInterface.php]"]
  node_serializer["Object Serializer"]
end

subgraph group_webhooks["Webhook Processing"]
  node_webhook_parser["Webhook Parser<br/>[WebhookParser.php]"]
  node_webhook_models["Webhook Payload Models"]
end

node_app(("Integrating App"))
node_dana{{"DANA REST API"}}

node_app -->|"configures"| node_configuration
node_app -->|"invokes"| node_payment_api
node_app -->|"invokes"| node_widget_api
node_app -->|"invokes"| node_disbursement_api
node_app -->|"invokes"| node_merchant_api
node_payment_api -->|"sends REST requests"| node_dana
node_widget_api -->|"sends REST requests"| node_dana
node_disbursement_api -->|"sends requests"| node_dana
node_merchant_api -->|"sends REST requests"| node_dana
node_disbursement_api -->|"uses"| node_configuration
node_disbursement_api -->|"serializes requests"| node_serializer
node_disbursement_api -->|"uses headers"| node_snap_headers
node_disbursement_api -->|"raises"| node_api_errors
node_disbursement_api -->|"uses payloads"| node_disbursement_models
node_payment_models -->|"extends"| node_base_model
node_widget_models -->|"extends"| node_base_model
node_disbursement_models -->|"extends"| node_base_model
node_merchant_models -->|"extends"| node_base_model
node_webhook_models -->|"uses"| node_base_model
node_base_model -->|"implements"| node_model_interface
node_base_model -->|"uses"| node_serializer
node_webhook_parser -->|"converts keys"| node_snap_headers
node_webhook_parser -->|"builds payloads"| node_webhook_models
node_app -->|"parses notifications"| node_webhook_parser
node_dana -.->|"delivers webhook"| node_app

click node_payment_api "https://github.com/dana-id/dana-php/blob/main/lib/PaymentGateway/v1/Api/PaymentGatewayApi.php"
click node_payment_models "https://github.com/dana-id/dana-php/tree/main/lib/PaymentGateway/v1/Model"
click node_widget_api "https://github.com/dana-id/dana-php/blob/main/lib/Widget/v1/Api/WidgetApi.php"
click node_widget_models "https://github.com/dana-id/dana-php/tree/main/lib/Widget/v1/Model"
click node_disbursement_api "https://github.com/dana-id/dana-php/blob/main/lib/Disbursement/v1/Api/DisbursementApi.php"
click node_disbursement_models "https://github.com/dana-id/dana-php/tree/main/lib/Disbursement/v1/Model"
click node_merchant_api "https://github.com/dana-id/dana-php/blob/main/lib/MerchantManagement/v1/Api/MerchantManagementApi.php"
click node_merchant_models "https://github.com/dana-id/dana-php/tree/main/lib/MerchantManagement/v1/Model"
click node_configuration "https://github.com/dana-id/dana-php/blob/main/lib/Configuration.php"
click node_snap_headers "https://github.com/dana-id/dana-php/blob/main/lib/Utils/SnapHeader.php"
click node_api_errors "https://github.com/dana-id/dana-php/blob/main/lib/ApiException.php"
click node_base_model "https://github.com/dana-id/dana-php/blob/main/lib/Model/BaseModel.php"
click node_model_interface "https://github.com/dana-id/dana-php/blob/main/lib/Model/ModelInterface.php"
click node_serializer "https://github.com/dana-id/dana-php/blob/main/lib/ObjectSerializer.php"
click node_webhook_parser "https://github.com/dana-id/dana-php/blob/main/lib/Webhook/v1/WebhookParser.php"
click node_webhook_models "https://github.com/dana-id/dana-php/tree/main/lib/Webhook/v1"

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_payment_api,node_payment_models,node_widget_api,node_widget_models toneBlue
class node_disbursement_api,node_disbursement_models,node_merchant_api,node_merchant_models toneAmber
class node_configuration,node_snap_headers,node_api_errors,node_base_model,node_model_interface,node_serializer,node_dana toneMint
class node_webhook_parser,node_webhook_models toneRose
class node_app toneIndigo
```

## Components

### Payments and Widgets

- [Payment Gateway API](https://github.com/dana-id/dana-php/blob/main/lib/PaymentGateway/v1/Api/PaymentGatewayApi.php): `lib/PaymentGateway/v1/Api/PaymentGatewayApi.php`
- [Payment Models](https://github.com/dana-id/dana-php/tree/main/lib/PaymentGateway/v1/Model): `lib/PaymentGateway/v1/Model`
- [Widget API](https://github.com/dana-id/dana-php/blob/main/lib/Widget/v1/Api/WidgetApi.php): `lib/Widget/v1/Api/WidgetApi.php`
- [Widget Models](https://github.com/dana-id/dana-php/tree/main/lib/Widget/v1/Model): `lib/Widget/v1/Model`

### Merchant and Disbursement

- [Disbursement API](https://github.com/dana-id/dana-php/blob/main/lib/Disbursement/v1/Api/DisbursementApi.php): `lib/Disbursement/v1/Api/DisbursementApi.php`
- [Disbursement Models](https://github.com/dana-id/dana-php/tree/main/lib/Disbursement/v1/Model): `lib/Disbursement/v1/Model`
- [Merchant API](https://github.com/dana-id/dana-php/blob/main/lib/MerchantManagement/v1/Api/MerchantManagementApi.php): `lib/MerchantManagement/v1/Api/MerchantManagementApi.php`
- [Merchant Models](https://github.com/dana-id/dana-php/tree/main/lib/MerchantManagement/v1/Model): `lib/MerchantManagement/v1/Model`

### SDK Infrastructure

- [Configuration](https://github.com/dana-id/dana-php/blob/main/lib/Configuration.php): `lib/Configuration.php`
- [SNAP Headers](https://github.com/dana-id/dana-php/blob/main/lib/Utils/SnapHeader.php): `lib/Utils/SnapHeader.php`
- [API Exceptions](https://github.com/dana-id/dana-php/blob/main/lib/ApiException.php): `lib/ApiException.php`
- [Base Model](https://github.com/dana-id/dana-php/blob/main/lib/Model/BaseModel.php): `lib/Model/BaseModel.php`
- [Model Interface](https://github.com/dana-id/dana-php/blob/main/lib/Model/ModelInterface.php): `lib/Model/ModelInterface.php`
- [Object Serializer](https://github.com/dana-id/dana-php/blob/main/lib/ObjectSerializer.php): `lib/ObjectSerializer.php`

### Webhook Processing

- [Webhook Parser](https://github.com/dana-id/dana-php/blob/main/lib/Webhook/v1/WebhookParser.php): `lib/Webhook/v1/WebhookParser.php`
- [Webhook Payload Models](https://github.com/dana-id/dana-php/tree/main/lib/Webhook/v1): `lib/Webhook/v1`

### Other components

- **Integrating App**
- **DANA REST API**

## Connections

- Integrating App → Configuration: configures (evidence: `README.md`)
- Integrating App → Payment Gateway API: invokes (evidence: `README.md`)
- Integrating App → Widget API: invokes (evidence: `README.md`)
- Integrating App → Disbursement API: invokes (evidence: `README.md`)
- Integrating App → Merchant API: invokes (evidence: `README.md`)
- Payment Gateway API → DANA REST API: sends REST requests (evidence: `README.md`)
- Widget API → DANA REST API: sends REST requests (evidence: `README.md`)
- Disbursement API → DANA REST API: sends requests (evidence: `lib/Disbursement/v1/Api/DisbursementApi.php`)
- Merchant API → DANA REST API: sends REST requests (evidence: `README.md`)
- Disbursement API → Configuration: uses (evidence: `lib/Disbursement/v1/Api/DisbursementApi.php`)
- Disbursement API → Object Serializer: serializes requests (evidence: `lib/Disbursement/v1/Api/DisbursementApi.php`)
- Disbursement API → SNAP Headers: uses headers (evidence: `lib/Disbursement/v1/Api/DisbursementApi.php`)
- Disbursement API → API Exceptions: raises (evidence: `lib/Disbursement/v1/Api/DisbursementApi.php`)
- Disbursement API → Disbursement Models: uses payloads (evidence: `lib/Disbursement/v1/Api/DisbursementApi.php`)
- Payment Models → Base Model: extends (evidence: `lib/PaymentGateway/v1/Model/QueryPaymentResponse.php`)
- Widget Models → Base Model: extends (evidence: `lib/Widget/v1/Model/QueryPaymentResponse.php`)
- Disbursement Models → Base Model: extends (evidence: `lib/Disbursement/v1/Model/BankAccountInquiryResponse.php`)
- Merchant Models → Base Model: extends (evidence: `lib/MerchantManagement/v1/Model/QueryDivisionResponseResponseHead.php`)
- Webhook Payload Models → Base Model: uses (evidence: `lib/Webhook/v1/FinishNotifyRequest.php`)
- Base Model → Model Interface: implements (evidence: `lib/Model/BaseModel.php`)
- Base Model → Object Serializer: uses (evidence: `lib/Model/BaseModel.php`)
- Webhook Parser → SNAP Headers: converts keys (evidence: `lib/Webhook/v1/WebhookParser.php`)
- Webhook Parser → Webhook Payload Models: builds payloads (evidence: `lib/Webhook/v1/WebhookParser.php`)
- Integrating App → Webhook Parser: parses notifications (evidence: `lib/Webhook/v1/WebhookParser.php`)
- DANA REST API → Integrating App: delivers webhook (evidence: `README.md`)
