emmedy/h5p-bundle

H5P Bundle for Symfony 5, 6 and Symfony 7

Installs: 605

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 3

Forks: 13

Open Issues: 2

Type:symfony-bundle

3.0.2 2024-11-21 22:02 UTC

This package is auto-updated.

Last update: 2024-12-21 22:08:14 UTC


README

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

This bundle was tested on :

  • Symfony 4.X
  • Symfony 5.X,
  • Symfony 6.X,
  • Symfony 7.X-dev

Prerequisite

You need install orm before running this installation

composer require orm

Installation

Install with composer

composer require emmedy/h5p-bundle

Enable the bundle in AppKernel.php

return [
// ...
    \Emmedy\H5PBundle\EmmedyH5PBundle::class => ['all' => true]
]

Warning for Windows : You need launch the cmd in administrator or using option -c

Add the H5P assets to the bundle

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

and reexecute ...

# For linux and mac only or windows admin
php bin/console h5p-bundle:IncludeAssetsCommand
# For all without admin perms
php bin/console h5p-bundle:IncludeAssetsCommand -c

Add required tables and relations to the database

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

or

php bin/console make:migrations

Enable the routing in routes.yaml

emmedy_h5p.demo:
    resource: "@EmmedyH5PBundle/Resources/config/routing_demo.yml"
    prefix:   /

emmedy_h5p:
    resource: "@EmmedyH5PBundle/Resources/config/routes.yaml"
    prefix:   /

emmedy_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

For SF4: Configure the bundle in services.yaml. (Watch for the underscore between h5 and p)

parameters:
    emmedy_h5_p:
        use_permission: true # This is false by default to let the demo work out of the box.
        storage_dir: / # 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 Symfony 5: Configure the bundle in packages > h5pBundle.yml.

emmedy_h5_p:
    use_permission: true # This is false by default to let the demo work out of the box.
    storage_dir: / # 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

if you are using permissions here is the current list of permissions in the bundle :

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:

  • Using dev version with restrict tag for prevent Break Change
  • Implement missing road and resolve compatibility of H5P-editor
  • Fix bug and update the readme
  • Fix many bug ... and update to SF5 :)
  • Fix bug with missing link img
  • Fix Download package
  • Store usage data and points

Developing:

Run the static analyzer like that:

php -d memory_limit=-1 vendor/bin/phpstan.phar analyze .