# tomas-kulhanek/czech-data-box architecture

> Architecture diagram of the GitHub repository tomas-kulhanek/czech-data-box, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tomas-kulhanek/czech-data-box
- Repository: https://github.com/tomas-kulhanek/czech-data-box

## Overview

##### Project type and purpose
- It exposes a Connector façade, a rich set of Request/Response DTOs, and a Provider abstraction to plug in any PSR-compatible HTTP client (Guzzle or Symfony).

##### File structure
- Top-level artifacts:
- src/Connector.php – main façade for all operations
- src/Account.php – holds credentials and environment flag
- src/Provider/* – ClientProviderInterface + two implementations (Guzzle, Symfony)
- src/DTO/Request and src/DTO/Response – full set of strongly typed request/response models
- src/Enum, src/Traits, src/Exception, src/Utils – supporting code
- composer.json, Dockerfile, phpunit.xml and related config define build, test, lint, and CI.

##### README
- Confirms this is a simple SDK: create an Account, pick a Provider, inject into Connector, then call methods.
- Mentions dependency on a SerializerFactory for (de)serializing between PHP objects and XML payloads.

##### Final checklist
- All main components present
- External API boundary clearly marked
- Notes on protocols (SOAP/XML over HTTPS, mutual TLS) and formats (XML)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Application Layer
    App["Consumer Application"] 

    %% SDK Core
    subgraph "SDK Core"
        Connector["Connector"]:::core
        Account["Account"]:::core
        Serializer["SerializerFactory"]:::core
        EndpointProvider["EndpointProvider"]:::core
    end

    %% Domain Layer
    subgraph "Domain Layer"
        DTOReq["Request DTOs"]:::domain
        DTORes["Response DTOs"]:::domain
        Enums["Enums"]:::domain
        Exceptions["Exceptions"]:::domain
        Traits["Traits"]:::domain
        Utils["Utils"]:::domain
    end

    %% Transport Layer
    subgraph "Transport Layer"
        ClientProviderInterface["ClientProviderInterface"]:::transport,interface
        GuzzleCP["GuzzleClientProvider"]:::transport
        SymfonyCP["SymfonyClientProvider"]:::transport
        HTTPClient["HTTP Client"]:::transport
    end

    %% External System
    ISDS["ISDS SOAP API"]:::external

    %% Config & Tooling
    subgraph "Tooling & Config"
        Composer["composer.json"]:::core
        PHPUnit["phpunit.xml"]:::core
        PHPStan["phpstan.neon"]:::core
        Rector["rector.php"]:::core
        Ruleset["ruleset.xml"]:::core
        Dockerfile["Dockerfile"]:::core
    end

    %% Tests
    subgraph "Tests"
        UnitTests["Unit Tests"]:::core
        IntegrationTests["Integration Tests"]:::core
    end

    %% Data Flows
    App -->|"operationX(RequestDTO)"| Connector
    Connector -->|"serialize(RequestDTO)"| Serializer
    Connector -->|"getEndpoint(Account,RequestDTO)"| EndpointProvider
    Account --> EndpointProvider
    Connector -->|"sendRequest(xmlPayload,endpoint,headers)"| ClientProviderInterface
    ClientProviderInterface -->|"sendRequest"| HTTPClient
    GuzzleCP -.->|implements| ClientProviderInterface
    SymfonyCP -.->|implements| ClientProviderInterface
    HTTPClient -->|"SOAP request"| ISDS
    ISDS -->|"SOAP response"| HTTPClient
    HTTPClient --> ClientProviderInterface
    ClientProviderInterface --> Connector
    Connector -->|"deserialize(XML)"| Serializer
    Serializer -->|"ResponseDTO"| Connector
    Connector -->|"return ResponseDTO or throw Exception"| App

    %% Click Events
    click Connector "https://github.com/tomas-kulhanek/czech-data-box/blob/main/src/Connector.php"
    click Account "https://github.com/tomas-kulhanek/czech-data-box/blob/main/src/Account.php"
    click ClientProviderInterface "https://github.com/tomas-kulhanek/czech-data-box/blob/main/src/Provider/ClientProviderInterface.php"
    click GuzzleCP "https://github.com/tomas-kulhanek/czech-data-box/blob/main/src/Provider/GuzzleClientProvider.php"
    click SymfonyCP "https://github.com/tomas-kulhanek/czech-data-box/blob/main/src/Provider/SymfonyClientProvider.php"
    click EndpointProvider "https://github.com/tomas-kulhanek/czech-data-box/blob/main/src/Provider/EndpointProvider.php"
    click DTOReq "https://github.com/tomas-kulhanek/czech-data-box/tree/main/src/DTO/Request/"
    click DTORes "https://github.com/tomas-kulhanek/czech-data-box/tree/main/src/DTO/Response/"
    click Enums "https://github.com/tomas-kulhanek/czech-data-box/tree/main/src/Enum/"
    click Exceptions "https://github.com/tomas-kulhanek/czech-data-box/tree/main/src/Exception/"
    click Traits "https://github.com/tomas-kulhanek/czech-data-box/tree/main/src/Traits/"
    click Utils "https://github.com/tomas-kulhanek/czech-data-box/tree/main/src/Utils/"
    click Composer "https://github.com/tomas-kulhanek/czech-data-box/blob/main/composer.json"
    click PHPUnit "https://github.com/tomas-kulhanek/czech-data-box/blob/main/phpunit.xml"
    click PHPStan "https://github.com/tomas-kulhanek/czech-data-box/blob/main/phpstan.neon"
    click Rector "https://github.com/tomas-kulhanek/czech-data-box/blob/main/rector.php"
    click Ruleset "https://github.com/tomas-kulhanek/czech-data-box/blob/main/ruleset.xml"
    click Dockerfile "https://github.com/tomas-kulhanek/czech-data-box/tree/main/Dockerfile"
    click UnitTests "https://github.com/tomas-kulhanek/czech-data-box/tree/main/tests/Unit/"
    click IntegrationTests "https://github.com/tomas-kulhanek/czech-data-box/tree/main/tests/Integration/"

    %% Styles
    classDef core fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef transport fill:#D0FFD0,stroke:#333,stroke-width:1px
    classDef domain fill:#FFE3B8,stroke:#333,stroke-width:1px
    classDef external fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef interface stroke-dasharray: 5 5,stroke:#333,fill:#D0FFD0
```
