PHPackages                             snordian/h5p-extractor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. snordian/h5p-extractor

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

snordian/h5p-extractor
======================

Allows to create H5P content HTML server-side

0.5.0(3mo ago)610.1k↑212.3%11MITPHP

Since Oct 3Pushed 4w ago1 watchersCompare

[ Source](https://github.com/otacke/H5PExtractor)[ Packagist](https://packagist.org/packages/snordian/h5p-extractor)[ RSS](/packages/snordian-h5p-extractor/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (2)Versions (5)Used By (1)

H5P Extractor - proof of concept
================================

[](#h5p-extractor---proof-of-concept)

Tool that is supposed to be be usable for rendering H5P content server-side.

Quick start (to be done properly (!))
-------------------------------------

[](#quick-start-to-be-done-properly-)

1. Copy the library to your ow project. You can also use composer, but you will need to fetch the library from github, because it is not available via packagist (yet).

    Your `composer.json` file should contain

    ```
    "repositories": [
         {
             "type": "vcs",
             "url": "https://github.com/otacke/H5PExtractor"
         }
     ],
     "require": {
         "snordian/h5p-extractor": "dev-master"
    }

    ```

    and any other of your dependencies, of course.
2. Use `require_once  . '/app/H5PExtractor.php';` to load code. It does autload everything it needs, but it is not instantiated by any autoload itself, because it it seems appropriate to only load H5PExtractor once actually needed.
3. Use `$h5pExtractor = new H5PExtractor\H5PExtractor($config);` to create an instance, where `$config` is supposed to be an optional an associative array containing configuration items, e.g.:

    ```
    $config = [
      'uploadsPath' =>
      'renderWidth' =>
      'renderWidths' => [
       '' => ,
      ]
      'target' =>
      'scope' =>
      'customCssPre' =>
      'customCssPost' =>
      'h5pCoreUrl' =>
      'h5pLibrariesUrl' =>
      'h5pContentUrl' =>
    ]

    ```

    By default, if that value is not set or no `$config` argument is passed, H5PExtractor will

    - try to create/use a directory named `uploads` inside its main `h5p-extractor` directory,
    - use a default render width of 1024 pixels,
    - use the default or set render width if no machineName specific render width was set for a particular content type,
    - not apply and custom CSS,
    - return base64 encoded representations of files inside the file if no Url to core, libraries or the content is set.

    Please ensure that the respective `uploads` directory can be read and written by your server process.
4. Use something like

    ```
    $extract = $h5pExtractor->extract(
        [
            'file' => $file['tmp_name'],
            'format' => $_POST['format']
        ]
    );

    ```

    where

    - `file` is supposed to be the H5P file that contains the H5P content that is supposed to be rendered - here a standard temporary file generated by a form upload.
    - `format` specifies the desired output format (currently `html` (default) or `text`) - here the `format` key of the form upload.

    The return value is an associative array with the key `result` or `error`.

    - `result` contains the requested output format
    - `error` contains an error message if something went wrong.

Creating/changing generators
----------------------------

[](#creatingchanging-generators)

A generator is what creates a distinct output format from an H5P content. It will commonly be HTML or some plain text variant, but could be something different, too.

The generation process resembles how the H5P core composes H5P content from different content types, and methods such as `newRunnable` or `attach` were called that way because they have direct counterparts in H5P core/a content type. They also use the same arguments, even though they're not all required here. If you know `newRunnable` or `attach`, then you already know what they do here. And if you don't and learn what they do here, you learn something about H5P core and H5P content types as a side product :-)

### TODO: Explain Structure

[](#todo-explain-structure)

### TODO: Explain Generator

[](#todo-explain-generator)

### TODO: Explain GeneratorInterface

[](#todo-explain-generatorinterface)

### Open issues:

[](#open-issues)

- Implement handling of target and scope where needed
- Add option to display answers for questions
- Support H5P theming scheduled to be released late in 2025.

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance89

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~172 days

Total

2

Last Release

93d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16688047?v=4)[Oliver Tacke](/maintainers/otacke)[@otacke](https://github.com/otacke)

---

Top Contributors

[![otacke](https://avatars.githubusercontent.com/u/16688047?v=4)](https://github.com/otacke "otacke (243 commits)")

---

Tags

h5p

### Embed Badge

![Health badge](/badges/snordian-h5p-extractor/health.svg)

```
[![Health](https://phpackages.com/badges/snordian-h5p-extractor/health.svg)](https://phpackages.com/packages/snordian-h5p-extractor)
```

###  Alternatives

[h5p/h5p-core

H5P Core functionality in PHP

1461.6M38](/packages/h5p-h5p-core)[h5p/h5p-editor

H5P Editor functionality in PHP

781.6M32](/packages/h5p-h5p-editor)[jorisdugue/h5p-bundle

H5P Bundle for Symfony 5, 6 and Symfony 7

1131.8k](/packages/jorisdugue-h5p-bundle)[djoudi/laravel-h5p

H5P Plugin for Laravel platform - Updated for Laravel 12

232.2k](/packages/djoudi-laravel-h5p)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
