Back to services

PHPOffice

PHPOffice contains libraries which permits to write and read files from most office suites.

View alternatives to PHPOffice
Suggest edit
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Note: The official website could not be fetched this time, so the following content is compiled from known information about the project. For specific versions, licenses and feature details, please refer to each repository's documentation.

Overview

PHPOffice is an open-source organization on GitHub that maintains several libraries written in pure PHP. With these libraries, you can read, generate and modify common office documents directly from PHP applications, without installing Microsoft Office or LibreOffice.

Main projects

  • PhpSpreadsheet: Reads and writes spreadsheets in formats such as Xlsx, Xls, Ods and CSV, and handles cell styles, formula calculation, charts and multiple worksheets. It is the successor to the earlier PHPExcel project, which is no longer maintained. PhpSpreadsheet is released under the MIT license.
  • PHPWord: Creates, reads and writes word processing documents, supporting formats such as Word (DOCX), ODT, RTF and HTML. It handles paragraphs, tables, images, headers and footers, and can also replace content based on templates.
  • PHPPresentation: Creates, reads and writes presentations, supporting formats such as PowerPoint (PPTX) and ODP.
  • The organization also hosts other repositories related to office documents, such as PHPProject.

Target users and use cases

It is suited to PHP developers who need to process office documents automatically on the server side, for example exporting reports from a web application, generating contracts or invoices in bulk, or importing Excel data uploaded by users.

Key strengths

  • Pure PHP implementation with no dependency on external office software
  • Object-oriented API, with documentation and examples
  • Active community; often used by extension packages for frameworks such as Laravel and Symfony
  • Open source and free

Installation

Install via Composer, for example:

composer require phpoffice/phpspreadsheet
composer require phpoffice/phpword
composer require phpoffice/phppresentation

Technical requirements

  • A reasonably recent PHP version is required; see each repository's documentation for specifics
  • PHP extensions such as zip, xml and gd usually need to be enabled
  • Memory usage is high when processing large files; consider optimizations such as cell caching