# amigodheena/php-invoice-generator architecture

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

- Interactive diagram: https://gitdiagram.com/amigodheena/php-invoice-generator
- Repository: https://github.com/amigodheena/php-invoice-generator

## Overview

This is a self-hosted PHP invoicing workspace. Users create or edit invoices, select company and client details and catalog items, save records locally as JSON, then browse, filter, view, and export invoices as PDFs or CSV. Separate areas manage companies, products, analytics, saved filters, and data portability/backups. The sampled files show key endpoint-to-function calls; README documents additional capabilities such as pagination and MySQL migration. Several central modules were not sampled, so those subsystem links are omitted rather than inferred.

Main entry points: [`includes/functions.php`](https://github.com/amigodheena/php-invoice-generator/blob/main/includes/functions.php) (JSON records), [`manage_data.php`](https://github.com/amigodheena/php-invoice-generator/blob/main/manage_data.php) (Data management), [`index.php`](https://github.com/amigodheena/php-invoice-generator/blob/main/index.php) (Invoice dashboard), [`create_invoice.php`](https://github.com/amigodheena/php-invoice-generator/blob/main/create_invoice.php) (Create invoice)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_invoice["Invoice workflow"]
  node_dashboard["Invoice dashboard<br/>[index.php]"]
  node_create["Create invoice<br/>[create_invoice.php]"]
  node_edit["Edit invoice<br/>[edit_invoice.php]"]
  node_view["View invoice<br/>[view_invoice.php]"]
  node_delete["Delete invoice<br/>[delete_invoice.php]"]
  node_pdfendpoint["PDF download<br/>[download_pdf.php]"]
  node_pdfbuilder["PDF renderer<br/>[invoice_pdf.php]"]
  node_records[("JSON records<br/>[functions.php]")]
end

subgraph group_catalog["Business records"]
  node_companies["Company profiles"]
  node_products["Product catalog"]
  node_productsearch["Product search endpoint<br/>[get_products.php]"]
end

subgraph group_workspace["Discovery and insights"]
  node_filters["Saved filters<br/>[saved_filters.php]"]
  node_analytics["Analytics page<br/>[analytics.php]"]
  node_analyticsdata["Analytics calculations<br/>[analytics.php]"]
  node_csv["CSV export<br/>[export_csv.php]"]
end

subgraph group_data["Data portability"]
  node_dataadmin["Data management<br/>[manage_data.php]"]
  node_backup["Backup operations<br/>[functions.php]"]
  node_import["Data import<br/>[import_data.php]"]
  node_cloudproviders["Cloud provider adapters<br/>[providers.php]"]
  node_autobackup["Scheduled backup<br/>[auto_backup.php]"]
  node_mysql["MySQL migration"]
end

node_user(("Workspace user"))
node_cloud["Dropbox / Drive"]

node_user -->|"browses"| node_dashboard
node_user -->|"creates"| node_create
node_user -->|"manages"| node_companies
node_user -->|"manages"| node_products
node_user -->|"manages"| node_dataadmin
node_dashboard -->|"loads invoices"| node_records
node_create -->|"loads and saves"| node_records
node_edit -->|"loads and saves"| node_records
node_view -->|"loads invoice"| node_records
node_delete -->|"deletes invoice"| node_records
node_dashboard -.->|"opens details"| node_view
node_pdfendpoint -->|"builds PDF"| node_pdfbuilder
node_pdfendpoint -->|"loads invoice data"| node_records
node_companies -->|"reads and saves"| node_records
node_products -->|"reads and saves"| node_records
node_productsearch -->|"loads products"| node_records
node_create -.->|"searches products"| node_productsearch
node_edit -.->|"searches products"| node_productsearch
node_filters -.->|"reads and saves"| node_records
node_analytics -->|"requests calculations"| node_analyticsdata
node_analytics -->|"loads records"| node_records
node_csv -->|"exports invoices"| node_records
node_dataadmin -->|"manages backups"| node_backup
node_dataadmin -->|"loads adapters"| node_cloudproviders
node_dataadmin -.->|"imports archive"| node_import
node_dataadmin -.->|"requests migration"| node_mysql
node_backup -->|"archives data"| node_records
node_autobackup -.->|"creates backups"| node_backup
node_autobackup -->|"uses providers"| node_cloudproviders
node_cloudproviders -.->|"uploads backups"| node_cloud

click node_dashboard "https://github.com/amigodheena/php-invoice-generator/blob/main/index.php"
click node_create "https://github.com/amigodheena/php-invoice-generator/blob/main/create_invoice.php"
click node_edit "https://github.com/amigodheena/php-invoice-generator/blob/main/edit_invoice.php"
click node_view "https://github.com/amigodheena/php-invoice-generator/blob/main/view_invoice.php"
click node_delete "https://github.com/amigodheena/php-invoice-generator/blob/main/delete_invoice.php"
click node_pdfendpoint "https://github.com/amigodheena/php-invoice-generator/blob/main/download_pdf.php"
click node_pdfbuilder "https://github.com/amigodheena/php-invoice-generator/blob/main/includes/invoice_pdf.php"
click node_records "https://github.com/amigodheena/php-invoice-generator/blob/main/includes/functions.php"
click node_companies "https://github.com/amigodheena/php-invoice-generator/blob/main/manage_companies.php"
click node_products "https://github.com/amigodheena/php-invoice-generator/blob/main/manage_products.php"
click node_productsearch "https://github.com/amigodheena/php-invoice-generator/blob/main/ajax/get_products.php"
click node_filters "https://github.com/amigodheena/php-invoice-generator/blob/main/saved_filters.php"
click node_analytics "https://github.com/amigodheena/php-invoice-generator/blob/main/analytics.php"
click node_analyticsdata "https://github.com/amigodheena/php-invoice-generator/blob/main/includes/analytics.php"
click node_csv "https://github.com/amigodheena/php-invoice-generator/blob/main/export_csv.php"
click node_dataadmin "https://github.com/amigodheena/php-invoice-generator/blob/main/manage_data.php"
click node_backup "https://github.com/amigodheena/php-invoice-generator/blob/main/includes/functions.php"
click node_import "https://github.com/amigodheena/php-invoice-generator/blob/main/import_data.php"
click node_cloudproviders "https://github.com/amigodheena/php-invoice-generator/blob/main/includes/cloud/providers.php"
click node_autobackup "https://github.com/amigodheena/php-invoice-generator/blob/main/auto_backup.php"
click node_mysql "https://github.com/amigodheena/php-invoice-generator/blob/main/migrate_to_mysql.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_dashboard,node_create,node_edit,node_view,node_delete,node_pdfendpoint,node_pdfbuilder,node_records,node_user toneBlue
class node_companies,node_products,node_productsearch toneAmber
class node_filters,node_analytics,node_analyticsdata,node_csv toneMint
class node_dataadmin,node_backup,node_import,node_cloudproviders,node_autobackup,node_mysql toneRose
class node_cloud toneIndigo
```

## Components

### Invoice workflow

- [Invoice dashboard](https://github.com/amigodheena/php-invoice-generator/blob/main/index.php): `index.php`
- [Create invoice](https://github.com/amigodheena/php-invoice-generator/blob/main/create_invoice.php): `create_invoice.php`
- [Edit invoice](https://github.com/amigodheena/php-invoice-generator/blob/main/edit_invoice.php): `edit_invoice.php`
- [View invoice](https://github.com/amigodheena/php-invoice-generator/blob/main/view_invoice.php): `view_invoice.php`
- [Delete invoice](https://github.com/amigodheena/php-invoice-generator/blob/main/delete_invoice.php): `delete_invoice.php`
- [PDF download](https://github.com/amigodheena/php-invoice-generator/blob/main/download_pdf.php): `download_pdf.php`
- [PDF renderer](https://github.com/amigodheena/php-invoice-generator/blob/main/includes/invoice_pdf.php): `includes/invoice_pdf.php`
- [JSON records](https://github.com/amigodheena/php-invoice-generator/blob/main/includes/functions.php): `includes/functions.php`

### Business records

- [Company profiles](https://github.com/amigodheena/php-invoice-generator/blob/main/manage_companies.php): `manage_companies.php`
- [Product catalog](https://github.com/amigodheena/php-invoice-generator/blob/main/manage_products.php): `manage_products.php`
- [Product search endpoint](https://github.com/amigodheena/php-invoice-generator/blob/main/ajax/get_products.php): `ajax/get_products.php`

### Discovery and insights

- [Saved filters](https://github.com/amigodheena/php-invoice-generator/blob/main/saved_filters.php): `saved_filters.php`
- [Analytics page](https://github.com/amigodheena/php-invoice-generator/blob/main/analytics.php): `analytics.php`
- [Analytics calculations](https://github.com/amigodheena/php-invoice-generator/blob/main/includes/analytics.php): `includes/analytics.php`
- [CSV export](https://github.com/amigodheena/php-invoice-generator/blob/main/export_csv.php): `export_csv.php`

### Data portability

- [Data management](https://github.com/amigodheena/php-invoice-generator/blob/main/manage_data.php): `manage_data.php`
- [Backup operations](https://github.com/amigodheena/php-invoice-generator/blob/main/includes/functions.php): `includes/functions.php`
- [Data import](https://github.com/amigodheena/php-invoice-generator/blob/main/import_data.php): `import_data.php`
- [Cloud provider adapters](https://github.com/amigodheena/php-invoice-generator/blob/main/includes/cloud/providers.php): `includes/cloud/providers.php`
- [Scheduled backup](https://github.com/amigodheena/php-invoice-generator/blob/main/auto_backup.php): `auto_backup.php`
- [MySQL migration](https://github.com/amigodheena/php-invoice-generator/blob/main/migrate_to_mysql.php): `migrate_to_mysql.php`

### Other components

- **Workspace user**
- **Dropbox / Drive**

## Connections

- Workspace user → Invoice dashboard: browses (evidence: `README.md`)
- Workspace user → Create invoice: creates (evidence: `README.md`)
- Workspace user → Company profiles: manages (evidence: `README.md`)
- Workspace user → Product catalog: manages (evidence: `README.md`)
- Workspace user → Data management: manages (evidence: `README.md`)
- Invoice dashboard → JSON records: loads invoices (evidence: `index.php`)
- Create invoice → JSON records: loads and saves (evidence: `create_invoice.php`)
- Edit invoice → JSON records: loads and saves (evidence: `edit_invoice.php`)
- View invoice → JSON records: loads invoice (evidence: `view_invoice.php`)
- Delete invoice → JSON records: deletes invoice (evidence: `delete_invoice.php`)
- Invoice dashboard → View invoice: opens details
- PDF download → PDF renderer: builds PDF (evidence: `download_pdf.php`)
- PDF download → JSON records: loads invoice data (evidence: `download_pdf.php`)
- Company profiles → JSON records: reads and saves (evidence: `manage_companies.php`)
- Product catalog → JSON records: reads and saves (evidence: `manage_products.php`)
- Product search endpoint → JSON records: loads products (evidence: `ajax/get_products.php`)
- Create invoice → Product search endpoint: searches products
- Edit invoice → Product search endpoint: searches products
- Saved filters → JSON records: reads and saves (evidence: `saved_filters.php`)
- Analytics page → Analytics calculations: requests calculations (evidence: `analytics.php`)
- Analytics page → JSON records: loads records (evidence: `analytics.php`)
- CSV export → JSON records: exports invoices (evidence: `export_csv.php`)
- Data management → Backup operations: manages backups (evidence: `manage_data.php`)
- Data management → Cloud provider adapters: loads adapters (evidence: `manage_data.php`)
- Data management → Data import: imports archive
- Data management → MySQL migration: requests migration
- Backup operations → JSON records: archives data (evidence: `includes/functions.php`)
- Scheduled backup → Backup operations: creates backups (evidence: `auto_backup.php`)
- Scheduled backup → Cloud provider adapters: uses providers (evidence: `auto_backup.php`)
- Cloud provider adapters → Dropbox / Drive: uploads backups
