/h5p-bundle

A bundle to integrate h5p into your Symfony project.

Primary LanguagePHPMIT LicenseMIT

H5PBundle

Bundle to integrate H5P into Symfony. This bundle is a port of the H5P Drupal module. For more info about H5P see H5P.org

For Symfony 3.X => H5PBundle for Symfony 2.X and 3.X

This bundle was tested on Symfony 4.0 and Symfony 5.0

Installation

Install with composer

composer require studit/h5p-bundle

Enable the bundle in AppKernel.php

return [
// ...
    \Studit\H5PBundle\StuditH5PBundle::class => ['all' => true]
]

Warning for Windows : You need launch the cmd in administrator

Add the H5P assets to the bundle

php bin/console h5p-bundle:IncludeAssetsCommand
php bin/console assets:install --symlink

and reexcute ...

php bin/console h5p-bundle:IncludeAssetsCommand

Add required tables and relations to the database

php app/console doctrine:schema:update --force 

or

php app/console make:migrations

Enable the routing in routing.yml

studit_h5p.demo:
    resource: "@StuditH5PBundle/Resources/config/routing_demo.yml"
    prefix:   /

studit_h5p:
    resource: "@StuditH5PBundle/Resources/config/routing.yml"
    prefix:   /

studit_h5p.demo is optional. It can be used as an example how to use H5P within Symfony and test if this bundle is working properly.

Configuration

Configure the bundle in config.yml. (Watch for the underscore between h5 and p)

studit_h5_p:
    use_permission: true # This is false by default to let the demo work out of the box.
    storage_dir: h5p # Location to store all H5P libraries and files
    web_dir: public # Location of the public web directory
    export: 3 #for all
    embed: 3 #for all

For all configurations see Configuration.php

Usage

First add a virtual host that points to you project. Then in your browser go to http://<your virtualhost>/h5p/list

Todo

Working:

  • Store usage data and points (only if user is connected)
  • Download a H5P
  • Upload H5P
  • Update / Install H5P library
  • Store usage data and points

Not everything is ported yet. The following things still need to be done:

  • Upload library. Currently only H5P default libraries can be selected from Hub. (need custom h5p for testing )

Changelog:

  • Fix many bug ... and update to SF5 :)
  • Fix bug with missing link img
  • Fix Download package
  • Store usage data and points