# lostcause/smartbill architecture

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

- Interactive diagram: https://gitdiagram.com/lostcause/smartbill
- Repository: https://github.com/lostcause/smartbill

## Overview

This is a small Laravel integration library: an application configures SmartBill credentials and invokes the client, which sends requests to SmartBill’s cloud API. The client also exposes document creation and management, payment/status operations, and account/product lookups. The README demonstrates invoice creation; sampled client excerpts show the shared HTTP request mechanism and several API operations, but do not expose every method.

Main entry points: [`src/SmartBillCloudRestClient.php`](https://github.com/lostcause/smartbill/blob/master/src/SmartBillCloudRestClient.php) (REST client), [`src/SmartBill.php`](https://github.com/lostcause/smartbill/blob/master/src/SmartBill.php) (SmartBill wrapper), [`src/SmartBillServiceProvider.php`](https://github.com/lostcause/smartbill/blob/master/src/SmartBillServiceProvider.php) (Service provider), [`src/SmartBillFacade.php`](https://github.com/lostcause/smartbill/blob/master/src/SmartBillFacade.php) (Facade)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Laravel integration"]
  node_provider["Service provider"]
  node_configuration["Credentials and settings<br/>[smartbill.php]"]
  node_facade["Facade"]
end

subgraph group_client["SmartBill client"]
  node_smartbill["SmartBill wrapper<br/>[SmartBill.php]"]
  node_restclient["REST client"]
  node_documents["Document operations"]
  node_payments["Payment and status"]
  node_lookups["Account and stock lookups"]
end

subgraph group_remote["SmartBill API"]
  node_smartbill_api["SmartBill cloud API"]
end

node_application(("Laravel application"))

node_application -->|"invokes"| node_facade
node_provider -->|"merges config"| node_configuration
node_provider -->|"registers singleton"| node_smartbill
node_smartbill -->|"reads credentials"| node_configuration
node_smartbill -->|"extends"| node_restclient
node_facade -.->|"resolves service"| node_provider
node_application -->|"creates invoice"| node_smartbill
node_documents -->|"uses request helper"| node_restclient
node_payments -->|"uses request helper"| node_restclient
node_lookups -->|"uses request helper"| node_restclient
node_restclient -->|"sends HTTP requests"| node_smartbill_api
node_documents -->|"creates and manages documents"| node_smartbill_api
node_payments -->|"manages payments and status"| node_smartbill_api
node_lookups -->|"queries account data"| node_smartbill_api

click node_provider "https://github.com/lostcause/smartbill/blob/master/src/SmartBillServiceProvider.php"
click node_configuration "https://github.com/lostcause/smartbill/blob/master/config/smartbill.php"
click node_facade "https://github.com/lostcause/smartbill/blob/master/src/SmartBillFacade.php"
click node_smartbill "https://github.com/lostcause/smartbill/blob/master/src/SmartBill.php"
click node_restclient "https://github.com/lostcause/smartbill/blob/master/src/SmartBillCloudRestClient.php"
click node_documents "https://github.com/lostcause/smartbill/blob/master/src/SmartBillCloudRestClient.php"
click node_payments "https://github.com/lostcause/smartbill/blob/master/src/SmartBillCloudRestClient.php"
click node_lookups "https://github.com/lostcause/smartbill/blob/master/src/SmartBillCloudRestClient.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_provider,node_configuration,node_facade toneBlue
class node_smartbill,node_restclient,node_documents,node_payments,node_lookups toneAmber
class node_smartbill_api toneMint
class node_application toneIndigo
```

## Components

### Laravel integration

- [Service provider](https://github.com/lostcause/smartbill/blob/master/src/SmartBillServiceProvider.php): `src/SmartBillServiceProvider.php`
- [Credentials and settings](https://github.com/lostcause/smartbill/blob/master/config/smartbill.php): `config/smartbill.php`
- [Facade](https://github.com/lostcause/smartbill/blob/master/src/SmartBillFacade.php): `src/SmartBillFacade.php`

### SmartBill client

- [SmartBill wrapper](https://github.com/lostcause/smartbill/blob/master/src/SmartBill.php): `src/SmartBill.php`
- [REST client](https://github.com/lostcause/smartbill/blob/master/src/SmartBillCloudRestClient.php): `src/SmartBillCloudRestClient.php`
- [Document operations](https://github.com/lostcause/smartbill/blob/master/src/SmartBillCloudRestClient.php): `src/SmartBillCloudRestClient.php`
- [Payment and status](https://github.com/lostcause/smartbill/blob/master/src/SmartBillCloudRestClient.php): `src/SmartBillCloudRestClient.php`
- [Account and stock lookups](https://github.com/lostcause/smartbill/blob/master/src/SmartBillCloudRestClient.php): `src/SmartBillCloudRestClient.php`

### SmartBill API

- **SmartBill cloud API**

### Other components

- **Laravel application**

## Connections

- Laravel application → Facade: invokes (evidence: `README.md`)
- Service provider → Credentials and settings: merges config (evidence: `src/SmartBillServiceProvider.php`)
- Service provider → SmartBill wrapper: registers singleton (evidence: `src/SmartBillServiceProvider.php`)
- SmartBill wrapper → Credentials and settings: reads credentials (evidence: `src/SmartBill.php`)
- SmartBill wrapper → REST client: extends (evidence: `src/SmartBill.php`)
- Facade → Service provider: resolves service
- Laravel application → SmartBill wrapper: creates invoice (evidence: `README.md`)
- Document operations → REST client: uses request helper (evidence: `src/SmartBillCloudRestClient.php`)
- Payment and status → REST client: uses request helper (evidence: `src/SmartBillCloudRestClient.php`)
- Account and stock lookups → REST client: uses request helper (evidence: `src/SmartBillCloudRestClient.php`)
- REST client → SmartBill cloud API: sends HTTP requests (evidence: `src/SmartBillCloudRestClient.php`)
- Document operations → SmartBill cloud API: creates and manages documents (evidence: `src/SmartBillCloudRestClient.php`)
- Payment and status → SmartBill cloud API: manages payments and status (evidence: `src/SmartBillCloudRestClient.php`)
- Account and stock lookups → SmartBill cloud API: queries account data (evidence: `src/SmartBillCloudRestClient.php`)
