PHPPresentation - Read, Create and Write Presentations documents in PHP

Installs: 1 494 702

Dependents: 19

Suggesters: 0

Security: 0

Stars: 1 297

Watchers: 85

Forks: 514

Open Issues: 288

1.0.0 2021-11-25 08:43 UTC

This package is auto-updated.

Last update: 2024-06-30 00:46:30 UTC



Latest Stable Version Coverage Status Total Downloads License BountySource Join the chat at

Branch Master : PHPPresentation

Branch Develop : PHPPresentation

PHPPresentation is a library written in pure PHP that provides a set of classes to write to different presentation file formats, i.e. Microsoft Office Open XML (OOXML or OpenXML) or OASIS Open Document Format for Office Applications (OpenDocument or ODF).

PHPPresentation is an open source project licensed under the terms of LGPL version 3. PHPPresentation is aimed to be a high quality software product by incorporating continuous integration and unit testing. You can learn more about PHPPresentation by reading the Developers' Documentation and the API Documentation.

Read more about PHPPresentation:


  • Create an in-memory presentation representation
  • Set presentation meta data (author, title, description, etc)
  • Add slides from scratch or from existing one
  • Supports different fonts and font styles
  • Supports different formatting, styles, fills, gradients
  • Supports hyperlinks and rich-text strings
  • Add images with different styles (positioning, rotation, shadow)
  • Set printing options (header, footer, page margins, paper size, orientation)
  • Set transitions between slides
  • Output to different file formats: PowerPoint 2007 (.pptx), OpenDocument Presentation (.odp), Serialized Presentation)
  • ... and lots of other things!


PHPPresentation requires the following:


Composer method

It is recommended that you install the PHPPresentation library through composer. To do so, add the following lines to your composer.json.

    "require": {
       "phpoffice/phppresentation": "dev-master"

Manual download method

Alternatively, you can download the latest release from the releases page. In this case, you will have to register the autoloader. (Register autoloading is required only if you do not use composer in your project.)

require_once 'path/to/PhpPresentation/src/PhpPresentation/Autoloader.php';

You will also need to download the latest PHPOffice/Common release from its releases page. And you will also have to register its autoloader, too.

require_once 'path/to/PhpOffice/Common/src/Common/Autoloader.php';

Getting started

The following is a basic usage example of the PHPPresentation library.

// with your own install
require_once 'src/PhpPresentation/Autoloader.php';
require_once 'src/Common/Autoloader.php';

// with Composer
require_once 'vendor/autoload.php';

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 (drawing)
$shape = $currentSlide->createDrawingShape();
$shape->setName('PHPPresentation logo')
      ->setDescription('PHPPresentation logo')

// Create a shape (text)
$shape = $currentSlide->createRichTextShape()
$shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER );
$textRun = $shape->createTextRun('Thank you for using PHPPresentation!');
                   ->setColor( new Color( 'FFE06B20' ) );

$oWriterPPTX = IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007');
$oWriterPPTX->save(__DIR__ . "/sample.pptx");
$oWriterODP = IOFactory::createWriter($objPHPPowerPoint, 'ODPresentation');
$oWriterODP->save(__DIR__ . "/sample.odp");

More examples are provided in the samples folder. You can also read the Developers' Documentation and the API Documentation for more detail.


We welcome everyone to contribute to PHPPresentation. Below are some of the things that you can do to contribute: