# it-peoplelogy/laravel-xero-bridge architecture

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

- Interactive diagram: https://gitdiagram.com/it-peoplelogy/laravel-xero-bridge
- Repository: https://github.com/it-peoplelogy/laravel-xero-bridge

## Overview

Laravel Xero Bridge lets an application connect tenants to Xero, maintain OAuth credentials, and use wrapped Accounting API resources or raw requests; the application retains bookkeeping decisions. Webhooks and an optional, separate MyInvois TIN validator are additional product capabilities. The graph follows documented and indexed caller relationships; several resource internals and unsampled modules are not shown, so their downstream calls are omitted rather than inferred.

Main entry points: [`src/Client/XeroHttpClient.php`](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Client/XeroHttpClient.php) (Xero HTTP client), [`src/XeroBridgeManager.php`](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/XeroBridgeManager.php) (Bridge manager), [`src/MyInvois/MyInvoisClient.php`](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/MyInvois/MyInvoisClient.php) (MyInvois client), [`src/OAuth/TokenManager.php`](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/OAuth/TokenManager.php) (Token manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Laravel integration"]
  node_facade["XeroBridge facade<br/>[XeroBridge.php]"]
  node_manager["Bridge manager"]
  node_console["Management console"]
end

subgraph group_oauth["Connection lifecycle"]
  node_connect["Connect endpoint"]
  node_callback["OAuth callback"]
  node_identity["Identity client<br/>[IdentityClient.php]"]
  node_tokens["Token manager<br/>[TokenManager.php]"]
  node_repository["Connection repository"]
  node_connections[("Connection records<br/>[XeroConnection.php]")]
end

subgraph group_accounting["Xero Accounting"]
  node_invoices["Invoice resource<br/>[Invoices.php]"]
  node_contacts["Contact resource<br/>[Contacts.php]"]
  node_payments["Payment resource<br/>[Payments.php]"]
  node_settings["Settings resource<br/>[Settings.php]"]
  node_http["Xero HTTP client<br/>[XeroHttpClient.php]"]
end

subgraph group_webhooks["Webhook processing"]
  node_webhook["Webhook endpoint"]
  node_webhook_job["Webhook processor"]
  node_webhook_recorder["Event recorder"]
  node_webhook_records[("Webhook event records")]
end

subgraph group_operations["Diagnostics"]
  node_capture["API call recorder"]
  node_api_records[("API call records<br/>[XeroApiCall.php]")]
end

subgraph group_myinvois["MyInvois validation"]
  node_myinvois["MyInvois client<br/>[MyInvoisClient.php]"]
  node_myinvois_audit["Validation audit<br/>[MyInvoisAudit.php]"]
  node_myinvois_config["MyInvois configuration<br/>[MyInvoisConfig.php]"]
end

node_app(("Host application"))
node_xero(("Xero services"))
node_myinvois_api(("MyInvois service"))

node_app -->|"calls"| node_facade
node_facade -->|"resolves"| node_manager
node_manager -->|"creates resource"| node_invoices
node_manager -->|"creates resource"| node_contacts
node_manager -->|"creates resource"| node_payments
node_manager -->|"creates resource"| node_settings
node_manager -->|"uses"| node_tokens
node_app -->|"starts consent"| node_connect
node_connect -->|"builds authorization"| node_identity
node_app -->|"returns from consent"| node_callback
node_callback -->|"exchanges code"| node_identity
node_callback -->|"stores connection"| node_repository
node_tokens -->|"refreshes tokens"| node_identity
node_tokens -->|"persists tokens"| node_repository
node_repository -->|"persists"| node_connections
node_invoices -.->|"uses client"| node_http
node_contacts -.->|"uses client"| node_http
node_payments -.->|"uses client"| node_http
node_settings -.->|"uses client"| node_http
node_http -->|"sends requests"| node_xero
node_http -->|"gets valid token"| node_tokens
node_http -->|"records calls"| node_capture
node_capture -->|"stores records"| node_api_records
node_app -->|"receives callback"| node_webhook
node_webhook -->|"dispatches"| node_webhook_job
node_webhook_job -->|"records event"| node_webhook_recorder
node_webhook_recorder -->|"persists"| node_webhook_records
node_app -->|"opens console"| node_console
node_console -->|"validates TIN"| node_myinvois
node_myinvois -->|"checks taxpayer"| node_myinvois_api
node_myinvois -->|"records verdict"| node_myinvois_audit
node_myinvois -->|"reads settings"| node_myinvois_config

click node_facade "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Facades/XeroBridge.php"
click node_manager "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/XeroBridgeManager.php"
click node_connect "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Http/Controllers/XeroConnectController.php"
click node_callback "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Http/Controllers/XeroCallbackController.php"
click node_identity "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/OAuth/IdentityClient.php"
click node_tokens "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/OAuth/TokenManager.php"
click node_repository "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Repositories/EloquentConnectionRepository.php"
click node_connections "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Models/XeroConnection.php"
click node_invoices "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Resources/Invoices.php"
click node_contacts "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Resources/Contacts.php"
click node_payments "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Resources/Payments.php"
click node_settings "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Resources/Settings.php"
click node_http "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Client/XeroHttpClient.php"
click node_capture "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Capture/ApiCallRecorder.php"
click node_api_records "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Models/XeroApiCall.php"
click node_webhook "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Http/Controllers/XeroWebhookController.php"
click node_webhook_job "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Jobs/ProcessXeroWebhook.php"
click node_webhook_recorder "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Webhooks/WebhookEventRecorder.php"
click node_webhook_records "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Models/XeroWebhookEvent.php"
click node_console "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Http/Controllers/XeroConsoleController.php"
click node_myinvois "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/MyInvois/MyInvoisClient.php"
click node_myinvois_audit "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/MyInvois/MyInvoisAudit.php"
click node_myinvois_config "https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/MyInvois/MyInvoisConfig.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_facade,node_manager,node_console toneBlue
class node_connect,node_callback,node_identity,node_tokens,node_repository,node_connections toneAmber
class node_invoices,node_contacts,node_payments,node_settings,node_http toneMint
class node_webhook,node_webhook_job,node_webhook_recorder,node_webhook_records toneRose
class node_capture,node_api_records,node_app,node_xero,node_myinvois_api toneIndigo
class node_myinvois,node_myinvois_audit,node_myinvois_config toneTeal
```

## Components

### Laravel integration

- [XeroBridge facade](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Facades/XeroBridge.php): `src/Facades/XeroBridge.php`
- [Bridge manager](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/XeroBridgeManager.php): `src/XeroBridgeManager.php`
- [Management console](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Http/Controllers/XeroConsoleController.php): `src/Http/Controllers/XeroConsoleController.php`

### Connection lifecycle

- [Connect endpoint](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Http/Controllers/XeroConnectController.php): `src/Http/Controllers/XeroConnectController.php`
- [OAuth callback](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Http/Controllers/XeroCallbackController.php): `src/Http/Controllers/XeroCallbackController.php`
- [Identity client](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/OAuth/IdentityClient.php): `src/OAuth/IdentityClient.php`
- [Token manager](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/OAuth/TokenManager.php): `src/OAuth/TokenManager.php`
- [Connection repository](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Repositories/EloquentConnectionRepository.php): `src/Repositories/EloquentConnectionRepository.php`
- [Connection records](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Models/XeroConnection.php): `src/Models/XeroConnection.php`

### Xero Accounting

- [Invoice resource](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Resources/Invoices.php): `src/Resources/Invoices.php`
- [Contact resource](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Resources/Contacts.php): `src/Resources/Contacts.php`
- [Payment resource](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Resources/Payments.php): `src/Resources/Payments.php`
- [Settings resource](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Resources/Settings.php): `src/Resources/Settings.php`
- [Xero HTTP client](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Client/XeroHttpClient.php): `src/Client/XeroHttpClient.php`

### Webhook processing

- [Webhook endpoint](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Http/Controllers/XeroWebhookController.php): `src/Http/Controllers/XeroWebhookController.php`
- [Webhook processor](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Jobs/ProcessXeroWebhook.php): `src/Jobs/ProcessXeroWebhook.php`
- [Event recorder](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Webhooks/WebhookEventRecorder.php): `src/Webhooks/WebhookEventRecorder.php`
- [Webhook event records](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Models/XeroWebhookEvent.php): `src/Models/XeroWebhookEvent.php`

### Diagnostics

- [API call recorder](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Capture/ApiCallRecorder.php): `src/Capture/ApiCallRecorder.php`
- [API call records](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/Models/XeroApiCall.php): `src/Models/XeroApiCall.php`

### MyInvois validation

- [MyInvois client](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/MyInvois/MyInvoisClient.php): `src/MyInvois/MyInvoisClient.php`
- [Validation audit](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/MyInvois/MyInvoisAudit.php): `src/MyInvois/MyInvoisAudit.php`
- [MyInvois configuration](https://github.com/it-peoplelogy/laravel-xero-bridge/blob/main/src/MyInvois/MyInvoisConfig.php): `src/MyInvois/MyInvoisConfig.php`

### Other components

- **Host application**
- **Xero services**
- **MyInvois service**

## Connections

- Host application → XeroBridge facade: calls (evidence: `README.md`)
- XeroBridge facade → Bridge manager: resolves (evidence: `src/Facades/XeroBridge.php`)
- Bridge manager → Invoice resource: creates resource (evidence: `src/XeroBridgeManager.php`)
- Bridge manager → Contact resource: creates resource (evidence: `src/XeroBridgeManager.php`)
- Bridge manager → Payment resource: creates resource (evidence: `src/XeroBridgeManager.php`)
- Bridge manager → Settings resource: creates resource (evidence: `src/XeroBridgeManager.php`)
- Bridge manager → Token manager: uses (evidence: `src/XeroBridgeManager.php`)
- Host application → Connect endpoint: starts consent (evidence: `src/Http/Controllers/XeroConnectController.php`)
- Connect endpoint → Identity client: builds authorization (evidence: `src/Http/Controllers/XeroConnectController.php`)
- Host application → OAuth callback: returns from consent (evidence: `src/Http/Controllers/XeroCallbackController.php`)
- OAuth callback → Identity client: exchanges code (evidence: `src/Http/Controllers/XeroCallbackController.php`)
- OAuth callback → Connection repository: stores connection (evidence: `src/Http/Controllers/XeroCallbackController.php`)
- Token manager → Identity client: refreshes tokens (evidence: `src/OAuth/TokenManager.php`)
- Token manager → Connection repository: persists tokens (evidence: `src/OAuth/TokenManager.php`)
- Connection repository → Connection records: persists (evidence: `src/Repositories/EloquentConnectionRepository.php`)
- Invoice resource → Xero HTTP client: uses client
- Contact resource → Xero HTTP client: uses client
- Payment resource → Xero HTTP client: uses client
- Settings resource → Xero HTTP client: uses client
- Xero HTTP client → Xero services: sends requests (evidence: `README.md`)
- Xero HTTP client → Token manager: gets valid token (evidence: `src/Client/XeroHttpClient.php`)
- Xero HTTP client → API call recorder: records calls (evidence: `src/Client/XeroHttpClient.php`)
- API call recorder → API call records: stores records (evidence: `src/Capture/ApiCallRecorder.php`)
- Host application → Webhook endpoint: receives callback
- Webhook endpoint → Webhook processor: dispatches (evidence: `src/Http/Controllers/XeroWebhookController.php`)
- Webhook processor → Event recorder: records event (evidence: `src/Jobs/ProcessXeroWebhook.php`)
- Event recorder → Webhook event records: persists (evidence: `src/Webhooks/WebhookEventRecorder.php`)
- Host application → Management console: opens console (evidence: `README.md`)
- Management console → MyInvois client: validates TIN (evidence: `src/Http/Controllers/XeroConsoleController.php`)
- MyInvois client → MyInvois service: checks taxpayer (evidence: `README.md`)
- MyInvois client → Validation audit: records verdict (evidence: `src/MyInvois/MyInvoisClient.php`)
- MyInvois client → MyInvois configuration: reads settings (evidence: `src/MyInvois/MyInvoisClient.php`)
