# paymentassist/creditsafe-callreport architecture

> Architecture diagram of the GitHub repository paymentassist/creditsafe-callreport, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/paymentassist/creditsafe-callreport
- Repository: https://github.com/paymentassist/creditsafe-callreport

## Overview

##### Project type and purpose
- This is a PHP-based client library (an SDK) for interacting with the CreditSafe CallReport SOAP API.
- Its sole purpose is to provide a typed, authenticated wrapper around remote SOAP calls to CreditSafe’s CallReport service.

##### File structure
- Top-level:
- config/ – contains the WSDL definitions and a PHP file (`soap-client.php`) for basic SOAP client configuration.
- example.php – a usage example.
- src/ – all core library code.
- Within src/:
- CreditsafeClientFactory.php – factory that reads ENV vars, configures middleware and SOAP client.
- CreditsafeMiddleware.php – middleware that injects authentication headers.
- CreditsafeClient.php – high-level façade exposing methods for each API operation.
- CreditsafeClassmap.php – maps WSDL types to PHP classes.
- Type/ – generated PHP classes (one per WSDL type) used as request/response models.
- There are no controllers, databases, UIs or microservices—just a single client library.

##### README for additional insights
- It’s installed via Composer.
- Requires environment variables for credentials.
- `CreditsafeMiddleware` handles authentication.
- `example.php` shows instantiation and usage.

## Diagram (Mermaid)

```mermaid
flowchart TD
    ConsumerApp["Consumer Application"]:::app
    ENV["Environment Variables"]:::infra
    CreditsafeClientFactory["CreditsafeClientFactory"]:::app
    CreditsafeMiddleware["CreditsafeMiddleware"]:::app
    SoapClientConfig["SOAP Client Configuration"]:::infra
    WSDL1["CallReport7.wsdl"]:::infra
    WSDL2["CallReport7Test.wsdl"]:::infra
    CreditsafeClassmap["CreditsafeClassmap"]:::infra
    CreditsafeClient["CreditsafeClient"]:::app
    TypeClasses["Type Model Classes"]:::infra
    SoapClient["PHP SoapClient"]:::infra
    ExternalService["CreditSafe CallReport SOAP Service"]:::external

    ConsumerApp -->|instantiates| CreditsafeClientFactory
    ENV -->|reads| CreditsafeClientFactory
    CreditsafeClientFactory -->|creates| CreditsafeMiddleware
    CreditsafeClientFactory -->|configures| SoapClientConfig
    CreditsafeClientFactory -->|provides| CreditsafeClassmap
    CreditsafeClientFactory -->|returns| CreditsafeClient

    ConsumerApp -->|calls method| CreditsafeClient
    CreditsafeClient -->|marshals args into| TypeClasses
    CreditsafeClient -->|invokes| CreditsafeMiddleware
    CreditsafeMiddleware -->|attaches auth to| SoapClient
    SoapClientConfig -->|initializes| SoapClient
    WSDL1 -->|used by| SoapClientConfig
    WSDL2 -->|used by| SoapClientConfig
    CreditsafeClassmap -->|used by| SoapClient
    SoapClient -->|sends request to| ExternalService
    ExternalService -->|responds with XML| SoapClient
    SoapClient -->|deserializes into| TypeClasses
    TypeClasses -->|returned to| CreditsafeClient
    CreditsafeClient -->|returns response to| ConsumerApp

    click ConsumerApp "https://github.com/paymentassist/creditsafe-callreport/blob/master/example.php"
    click CreditsafeClientFactory "https://github.com/paymentassist/creditsafe-callreport/blob/master/src/CreditsafeClientFactory.php"
    click CreditsafeMiddleware "https://github.com/paymentassist/creditsafe-callreport/blob/master/src/CreditsafeMiddleware.php"
    click CreditsafeClient "https://github.com/paymentassist/creditsafe-callreport/blob/master/src/CreditsafeClient.php"
    click CreditsafeClassmap "https://github.com/paymentassist/creditsafe-callreport/blob/master/src/CreditsafeClassmap.php"
    click SoapClientConfig "https://github.com/paymentassist/creditsafe-callreport/blob/master/config/soap-client.php"
    click WSDL1 "https://github.com/paymentassist/creditsafe-callreport/blob/master/config/CallReport7.wsdl"
    click WSDL2 "https://github.com/paymentassist/creditsafe-callreport/blob/master/config/CallReport7Test.wsdl"
    click TypeClasses "https://github.com/paymentassist/creditsafe-callreport/tree/master/src/Type/"

    classDef app fill:#e0ffe0,stroke:#36b37e,stroke-width:2px
    classDef infra fill:#e0f0ff,stroke:#0052cc,stroke-width:2px
    classDef external fill:#ffe0b2,stroke:#ff8b00,stroke-width:2px
```
