OpenSpout
A fast, low-memory PHP library for reading and writing CSV, XLSX, and ODS spreadsheet files.
Repository Health
Technical Analysis
OpenSpout is a community-maintained fork of box/spout that reads and writes spreadsheet files (CSV, XLSX, ODS) in PHP while keeping memory usage under roughly 3MB even for very large files, by streaming rows instead of building the whole document in memory. It’s used anywhere a PHP application needs to generate or parse spreadsheet exports/imports at scale — reporting tools, data exports, ETL pipelines — without hitting the memory limits typical of DOM-based spreadsheet libraries.
What You Get
- Streaming
Writerimplementations for CSV, XLSX, and ODS that keep memory usage flat regardless of file size - Streaming
Readerimplementations for the same three formats, iterating rows without loading the whole file - Shared
Common\Entityclasses (Row, Cell, Style) for consistent styling and cell typing across formats - Format-specific writer/reader subpackages (
Reader/XLSX,Writer/ODS, etc.) isolating each file format’s parsing/generation logic - An active fork lineage from box/spout with a documented v3→v4 upgrade guide and continued API evolution
Common Use Cases
- Generating large data exports (reports, invoices, bulk records) as XLSX or CSV without exhausting server memory
- Importing bulk spreadsheet uploads (product catalogs, user lists) into a database via streaming row iteration
- Building ETL pipelines that convert between CSV/XLSX/ODS formats at scale
- Replacing
box/spoutin existing codebases after that project became unmaintained, per OpenSpout’s documented migration path
Under The Hood
Architecture: The codebase splits cleanly along two axes — Reader vs Writer, and format (CSV/XLSX/ODS) — with shared concerns (row/cell entities, styling, exceptions) centralized under Common; XLSX/ODS writers generate the underlying XML/ZIP structure incrementally rather than building a full DOM, which is the mechanism behind its low memory footprint. Tech Stack: Modern PHP (actively tested against current PHP versions per its 2026 commit activity), zero heavyweight dependencies beyond PHP’s native ZipArchive/XMLWriter extensions, with PHPStan static analysis, PHPUnit tests, PHPBench for performance benchmarking, and Infection for mutation testing all wired into CI. Code Quality: The repo carries a published Infection mutation-score badge (a stronger quality signal than plain coverage), maintains a benchmarks/ directory to catch performance regressions, and documents breaking changes rigorously in UPGRADE.md — indicating deliberate attention to both correctness and the memory/speed guarantees that are the library’s core value proposition. API Design: Reader/Writer usage follows a consistent, minimal pattern across formats (Reader::open() → iterate getSheetIterator()/rows; Writer::openToFile() → addRow() → close()), so switching between CSV, XLSX, and ODS requires almost no code change beyond the class name.
Used by 2 apps in this directory
EspoCRM
Marketing · Ecommerce · CRM
Open-source CRM platform with metadata-driven customization, field-level permissions, and a full REST API — deploy on your own infrastructure.
Kimai
Invoicing Finance · Project Management
Professional open-source time tracking with invoicing, multi-user support, SAML/LDAP auth, and a full REST API—self-host it or use the cloud.