PHPPresentation: writing pptx and odp decks from PHP, with no Office installed
A pure PHP library for reading and writing presentations documents
At a glance
- What is it?
- PHPPresentation is a pure PHP library for reading and writing presentation documents, covering PowerPoint 2007 and OpenDocument formats, with an in-memory model, a writer factory and a samples folder that doubles as the documentation. This looks at what it covers and where it stops.
- Who is it for?
- PHPPresentation fits a PHP application that has to emit a deck, a report or a set of slides as a side effect of some other task, and that would rather not depend on a running office suite or on a binary document service. It does not fit a pipeline that needs to render slides to images or PDF, because the library writes files rather than rendering them, and it is the wrong tool for editing complex existing templates.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository last received commits 4 days ago.
- What is it written in?
- Mainly PHP, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 20, 2026, and from our analysis. They are not legal advice.
Editorial analysis
A document library that stops at the file boundary
PHPPresentation is a library written in pure PHP that provides a set of classes to write to different presentation file formats, namely Microsoft Office Open XML and the OASIS Open Document Format for Office Applications.
The word pure matters more here than in most PHP projects. There is no native extension to compile, no office suite to shell out to, and no headless LibreOffice on the server. The requirements are PHP 7.1 or later, the ZIP extension, the XML Parser extension, the GD extension, and optionally the XMLWriter extension, which the readme notes is used to write DOCX and ODT. Those are extensions most PHP installations already have.
The audience is therefore a specific one: a PHP application that has to produce a presentation as a side effect. A reporting system that exports a quarterly review as slides, a training portal that turns a course outline into a deck, a back office that assembles a board pack. In each of those cases the alternative is a template plus manual work, or a document conversion service, and a library that writes the file directly is simpler than either.
The licence is LGPL version 3 according to the readme, and the repository carries `COPYING`, `COPYING.LESSER` and `LICENSE` files at the root, with the project metadata listing the licence as a custom one that GitHub cannot classify. The readme says the project is aimed to be a high quality software product by incorporating continuous integration and unit testing, and the badges show a GitHub Actions workflow on the master branch and a Coveralls coverage status.
The feature list reads like a report generator's checklist
The features section is a list of verbs, and each one is a job you would otherwise do by hand in PowerPoint.
You can create an in-memory presentation representation, set presentation meta data such as author, title and description, and add slides from scratch or from an existing one. Formatting is covered: different fonts and font styles, different formatting, styles, fills and gradients, hyperlinks and rich-text strings, and images with different styles including positioning, rotation and shadow. Printing options can be set, with header, footer, page margins, paper size and orientation. Transitions between slides are supported. And the output goes to different file formats: PowerPoint 2007 as `.pptx`, OpenDocument Presentation as `.odp`, and a serialized presentation format.
That last one is worth pausing on. A serialized format means the deck can be round-tripped through the library's own model, which is what the `Sample_02_Serialized.php` example is for, and it is the shape a document service needs if it wants to keep an intermediate representation rather than re-reading the file.
The samples directory is the best evidence of coverage, and it is extensive: `Sample_01_Simple.php` and `Sample_01_Complex.php`, `Sample_02_Serialized.php`, images, video, `Sample_04_Table.php`, charts including `Sample_05_Chart_with_PhpSpreadsheet.php`, fills, borders, groups, slide notes, transitions, shapes, background, thumbnail, comment, animation, and `Sample_19_SlideMaster.php`. There are also three readers, `Sample_12_Reader_ODPresentation.php`, `Sample_12_Reader_PowerPoint2007.php` and `Sample_12_Reader_PowerPoint97.php`, which is a useful signal about the age of the formats the library expects to meet.
Installing with Composer, or by hand with two autoloaders
The recommended installation is Composer, and the readme gives the `composer.json` fragment to add.
{
"require": {
"phpoffice/phppresentation": "dev-master"
}
}That `dev-master` is worth pausing on for a production dependency, since it tracks the branch rather than a tagged release, and the release history here is not dense: 1.0.0 on 2021-11-25, 1.1.0 on 2024-09-01 and 1.2.0 on 2025-07-23. Pinning a version rather than a branch is the safer choice for an application that ships.
The manual route requires more work than the one-liner suggests, because the library has a shared companion library. You download the latest release from the releases page and register the autoloader yourself:
require_once 'path/to/PhpPresentation/src/PhpPresentation/Autoloader.php';
\PhpOffice\PhpPresentation\Autoloader::register();and then you also have to download the latest PHPOffice/Common release and register its autoloader as well:
require_once 'path/to/PhpOffice/Common/src/Common/Autoloader.php';
\PhpOffice\Common\Autoloader::register();The autoloading step is only required if you do not use Composer in your project, which is the usual reason to reach for the manual route at all.
A slide, a shape, a text run, and two writers
The getting started example is short enough to read as the API documentation, which is a compliment to the design.
use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\IOFactory;
use PhpOffice\PhpPresentation\Style\Color;
use PhpOffice\PhpPresentation\Style\Alignment;
$objPHPPowerPoint = new PhpPresentation();
// Create slide
$currentSlide = $objPHPPowerPoint->getActiveSlide();
// Create a shape (text)
$shape = $currentSlide->createRichTextShape()
->setHeight(300)
->setWidth(600)
->setOffsetX(170)
->setOffsetY(180);
$textRun = $shape->createTextRun('Thank you for using PHPPresentation!');
$textRun->getFont()->setBold(true)
->setSize(60)
->setColor( new Color( 'FFE06B20' ) );
$oWriterPPTX = IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007');
$oWriterPPTX->save(__DIR__ . "/sample.pptx");
$oWriterODP = IOFactory::createWriter($objPHPPowerPoint, 'ODPresentation');
$oWriterODP->save(__DIR__ . "/sample.odp");Three things are worth noting in it. The model is fluent and chainable, with setters returning the object so a shape is configured in one expression. The vocabulary separates a drawing shape from a rich text shape, and a text run inside a shape, which is the distinction you need when a paragraph has mixed formatting. And the output side is a writer factory keyed by format name, `PowerPoint2007` and `ODPresentation`, so the same in-memory deck is written twice here, once per format, and the format is a choice at write time rather than at build time.
The example also shows the drawing shape variant, with `getShadow()->setVisible(true)->setDirection(45)->setDistance(10)`, which is how the image-with-shadow feature in the list is actually expressed.
The toolchain around the library
The repository carries the quality tooling you would expect from a project that treats itself as a product, and it is all in the root as configuration files rather than hidden in scripts.
There is `.php-cs-fixer.dist.php` for coding style, `phpmd.xml.dist` for the mess detector, `phpstan.neon.dist` for static analysis, and `phpunit.xml.dist` for the test configuration. The documentation is built with MkDocs through `mkdocs.yml` and the `docs/` directory, and there is a `VERSION` file alongside `composer.json`.
The static analysis setup is the most interesting of these for an evaluator, because a document library that writes binary files people open in PowerPoint has no easy way to be checked by a human. Type checking across the whole surface is how the library keeps its API coherent, and the unit test coverage badge is tracked through Coveralls.
The `src/` and `tests/` directories mirror each other, and the samples double as executable documentation, which is a pattern worth borrowing: the `samples/` folder is the reference for what the library can do, and each file is short enough to read in a minute.
For the projects that use it, the practical entry points are the Developers' Documentation and the API Documentation, both hosted on the phpoffice.github.io site, with the readme directing people to the samples folder for more examples.
Where PHPPresentation is the wrong tool
Four limits are clear.
The first is that it writes files and does not render them. There is no path from a deck to a PDF or to preview images in this library, so a product that needs to show a slide in a browser has to render it elsewhere, most likely with LibreOffice, which reintroduces the dependency the library was chosen to avoid. The readme's own feature list ends at output formats and says nothing about rendering.
The second is the editing direction. The library is strongest going from code to file, and the samples show readers for OpenDocument, PowerPoint 2007 and PowerPoint 97, so reading is supported, but the sample set is overwhelmingly about creation. A requirement to open an existing corporate template and populate a few slides is a different job from the one this library is built around.
The third is the memory profile of a pure PHP implementation. Building a large deck means holding the whole presentation in memory as objects before writing, and a deck with thousands of images will be heavy for a shared PHP-FPM worker. That is a workload question, and the samples do not tell you the answer.
The fourth is the release stream. The tags are 1.0.0 from 2021, 1.1.0 from 2024 and 1.2.0 from 2025, and the last push to the repository was on 2026-10-09, so work is happening, but the tagged versions are infrequent and the readme's composer snippet points at `dev-master`. A team that wants a predictable dependency should pin a release and read the changelog.
On the licence, the readme states LGPL version 3, the repository carries `COPYING` and `COPYING.LESSER`, and the project metadata lists a custom licence that GitHub cannot classify. For an application that will ship a deck to a customer, that file is the one to read.
Editorial conclusion
PHPPresentation fits a PHP application that has to emit a deck, a report or a set of slides as a side effect of some other task, and that would rather not depend on a running office suite or on a binary document service. It does not fit a pipeline that needs to render slides to images or PDF, because the library writes files rather than rendering them, and it is the wrong tool for editing complex existing templates. Before you adopt it, check the release you pin, since the composer snippet in the readme points at `dev-master` rather than a tagged version, and note that the Common library is a separate download if you install without Composer.
Frequently asked questions
What does PHPPresentation do?
It is a pure PHP library that provides classes to write presentation documents in Microsoft Office Open XML and OpenDocument formats. It creates an in-memory presentation, supports slides, shapes, rich text, images, tables, charts, transitions, print options and meta data, and writes out .pptx, .odp or a serialized presentation format.
How do I install PHPPresentation?
Through Composer, by adding `"phpoffice/phppresentation": "dev-master"` to the require section of your composer.json. Manually, you download the release and the separate PHPOffice/Common release and register both autoloaders, which is only necessary if you do not use Composer.
Which PHP extensions does PHPPresentation need?
PHP 7.1 or later, the ZIP extension, the XML Parser extension, the GD extension, and optionally the XMLWriter extension, which the readme says is used to write DOCX and ODT. The library is pure PHP, so there is no native extension to compile.
Can PHPPresentation read existing presentations as well as write them?
Yes, the samples include readers for OpenDocument Presentation, PowerPoint 2007 and PowerPoint 97, in Sample_12_Reader_ODPresentation.php, Sample_12_Reader_PowerPoint2007.php and Sample_12_Reader_PowerPoint97.php.
Can PHPPresentation export a deck to PDF?
The documented output formats are PowerPoint 2007 as .pptx, OpenDocument Presentation as .odp, and a serialized presentation. The library writes those files; rendering to PDF or images is outside its scope and would need another tool.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/phpoffice-phppresentation)Was this useful?