# phpoffice/phpexcel architecture

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

- Interactive diagram: https://gitdiagram.com/phpoffice/phpexcel
- Repository: https://github.com/phpoffice/phpexcel

## Overview

PHPExcel is a PHP spreadsheet library for reading, creating, calculating, and writing spreadsheet documents; the repository is archived and its README advises migration. The graph follows the workbook-and-cell model, calculation and caching layers, and format-specific I/O families. The README confirms the broad product workflow, while several format-specific connections are shown dashed because their implementations were not sampled.

Main entry points: [`Classes/PHPExcel.php`](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel.php) (Workbook), [`Classes/PHPExcel/IOFactory.php`](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/IOFactory.php) (I/O Factory), [`Classes/PHPExcel/Calculation.php`](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Calculation.php) (Formula Engine), [`Classes/PHPExcel/Worksheet.php`](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Worksheet.php) (Worksheets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workbook["Workbook Model"]
  node_workbook["Workbook<br/>[PHPExcel.php]"]
  node_worksheet["Worksheets<br/>[Worksheet.php]"]
  node_cell["Cells<br/>[Cell.php]"]
  node_styles["Styles and Metadata<br/>[Style.php]"]
end

subgraph group_calc["Calculation Engine"]
  node_calculation["Formula Engine<br/>[Calculation.php]"]
  node_functionmap["Function Catalog<br/>[Function.php]"]
  node_functionfamilies["Function Families"]
end

subgraph group_io["Spreadsheet I/O"]
  node_excel5reader["Excel 5 Reader<br/>[Excel5.php]"]
  node_excel2007reader["Excel 2007 Reader<br/>[Excel2007.php]"]
  node_otherreaders["Other Readers"]
  node_iofactory["I/O Factory<br/>[IOFactory.php]"]
  node_excel5writer["Excel 5 Writer<br/>[Excel5.php]"]
  node_excel2007writer["Excel 2007 Writer<br/>[Excel2007.php]"]
  node_opendocument["OpenDocument Writer<br/>[Content.php]"]
  node_otherwriters["Other Writers"]
end

subgraph group_storage["Cell Storage"]
  node_cachefactory["Cache Factory"]
  node_cachebackends[("Cache Backends")]
end

node_user(("Library User"))

node_user -->|"creates or opens"| node_workbook
node_workbook -->|"creates sheets"| node_worksheet
node_worksheet -.->|"holds cells"| node_cell
node_workbook -->|"initializes engine"| node_calculation
node_cell -->|"requests evaluation"| node_calculation
node_calculation -->|"uses catalog"| node_functionmap
node_functionmap -->|"maps functions"| node_functionfamilies
node_user -.->|"selects I/O"| node_iofactory
node_iofactory -.->|"dispatches reads"| node_excel5reader
node_iofactory -.->|"dispatches reads"| node_excel2007reader
node_iofactory -.->|"dispatches reads"| node_otherreaders
node_excel5reader -.->|"populates workbook"| node_workbook
node_excel2007reader -.->|"populates workbook"| node_workbook
node_otherreaders -.->|"populates workbook"| node_workbook
node_user -.->|"requests export"| node_excel5writer
node_user -.->|"requests export"| node_excel2007writer
node_user -.->|"requests export"| node_opendocument
node_user -.->|"requests export"| node_otherwriters
node_excel5writer -.->|"serializes workbook"| node_workbook
node_excel2007writer -.->|"serializes workbook"| node_workbook
node_opendocument -.->|"serializes workbook"| node_workbook
node_otherwriters -.->|"serializes workbook"| node_workbook
node_workbook -.->|"configures cell caching"| node_cachefactory
node_cachefactory -->|"selects backend"| node_cachebackends

click node_workbook "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel.php"
click node_worksheet "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Worksheet.php"
click node_cell "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Cell.php"
click node_styles "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Style.php"
click node_calculation "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Calculation.php"
click node_functionmap "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Calculation/Function.php"
click node_functionfamilies "https://github.com/phpoffice/phpexcel/tree/1.8/Classes/PHPExcel/Calculation"
click node_excel5reader "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Reader/Excel5.php"
click node_excel2007reader "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Reader/Excel2007.php"
click node_otherreaders "https://github.com/phpoffice/phpexcel/tree/1.8/Classes/PHPExcel/Reader"
click node_iofactory "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/IOFactory.php"
click node_excel5writer "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Writer/Excel5.php"
click node_excel2007writer "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Writer/Excel2007.php"
click node_opendocument "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Writer/OpenDocument/Content.php"
click node_otherwriters "https://github.com/phpoffice/phpexcel/tree/1.8/Classes/PHPExcel/Writer"
click node_cachefactory "https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/CachedObjectStorageFactory.php"
click node_cachebackends "https://github.com/phpoffice/phpexcel/tree/1.8/Classes/PHPExcel/CachedObjectStorage"

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_workbook,node_worksheet,node_cell,node_styles,node_user toneBlue
class node_calculation,node_functionmap,node_functionfamilies toneAmber
class node_excel5reader,node_excel2007reader,node_otherreaders,node_iofactory,node_excel5writer,node_excel2007writer,node_opendocument,node_otherwriters toneMint
class node_cachefactory,node_cachebackends toneRose
```

## Components

### Workbook Model

- [Workbook](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel.php): `Classes/PHPExcel.php`
- [Worksheets](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Worksheet.php): `Classes/PHPExcel/Worksheet.php`
- [Cells](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Cell.php): `Classes/PHPExcel/Cell.php`
- [Styles and Metadata](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Style.php): `Classes/PHPExcel/Style.php`

### Calculation Engine

- [Formula Engine](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Calculation.php): `Classes/PHPExcel/Calculation.php`
- [Function Catalog](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Calculation/Function.php): `Classes/PHPExcel/Calculation/Function.php`
- [Function Families](https://github.com/phpoffice/phpexcel/tree/1.8/Classes/PHPExcel/Calculation): `Classes/PHPExcel/Calculation`

### Spreadsheet I/O

- [Excel 5 Reader](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Reader/Excel5.php): `Classes/PHPExcel/Reader/Excel5.php`
- [Excel 2007 Reader](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Reader/Excel2007.php): `Classes/PHPExcel/Reader/Excel2007.php`
- [Other Readers](https://github.com/phpoffice/phpexcel/tree/1.8/Classes/PHPExcel/Reader): `Classes/PHPExcel/Reader`
- [I/O Factory](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/IOFactory.php): `Classes/PHPExcel/IOFactory.php`
- [Excel 5 Writer](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Writer/Excel5.php): `Classes/PHPExcel/Writer/Excel5.php`
- [Excel 2007 Writer](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Writer/Excel2007.php): `Classes/PHPExcel/Writer/Excel2007.php`
- [OpenDocument Writer](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/Writer/OpenDocument/Content.php): `Classes/PHPExcel/Writer/OpenDocument/Content.php`
- [Other Writers](https://github.com/phpoffice/phpexcel/tree/1.8/Classes/PHPExcel/Writer): `Classes/PHPExcel/Writer`

### Cell Storage

- [Cache Factory](https://github.com/phpoffice/phpexcel/blob/1.8/Classes/PHPExcel/CachedObjectStorageFactory.php): `Classes/PHPExcel/CachedObjectStorageFactory.php`
- [Cache Backends](https://github.com/phpoffice/phpexcel/tree/1.8/Classes/PHPExcel/CachedObjectStorage): `Classes/PHPExcel/CachedObjectStorage`

### Other components

- **Library User**

## Connections

- Library User → Workbook: creates or opens
- Workbook → Worksheets: creates sheets (evidence: `Classes/PHPExcel.php`)
- Worksheets → Cells: holds cells
- Workbook → Formula Engine: initializes engine (evidence: `Classes/PHPExcel.php`)
- Cells → Formula Engine: requests evaluation (evidence: `Classes/PHPExcel/Cell.php`)
- Formula Engine → Function Catalog: uses catalog (evidence: `Classes/PHPExcel/Calculation.php`)
- Function Catalog → Function Families: maps functions (evidence: `Classes/PHPExcel/Calculation/Function.php`)
- Library User → I/O Factory: selects I/O
- I/O Factory → Excel 5 Reader: dispatches reads
- I/O Factory → Excel 2007 Reader: dispatches reads
- I/O Factory → Other Readers: dispatches reads
- Excel 5 Reader → Workbook: populates workbook (evidence: `Classes/PHPExcel/Reader/Excel5.php`)
- Excel 2007 Reader → Workbook: populates workbook
- Other Readers → Workbook: populates workbook (evidence: `Classes/PHPExcel/Reader/Excel5.php`)
- Library User → Excel 5 Writer: requests export
- Library User → Excel 2007 Writer: requests export
- Library User → OpenDocument Writer: requests export
- Library User → Other Writers: requests export
- Excel 5 Writer → Workbook: serializes workbook
- Excel 2007 Writer → Workbook: serializes workbook
- OpenDocument Writer → Workbook: serializes workbook
- Other Writers → Workbook: serializes workbook (evidence: `Classes/PHPExcel/Writer/HTML.php`)
- Workbook → Cache Factory: configures cell caching
- Cache Factory → Cache Backends: selects backend (evidence: `Classes/PHPExcel/CachedObjectStorageFactory.php`)
