jorisdugue/h5p-bundle

适用于 Symfony 5, 6 和 Symfony 7 的 H5P Bundle

安装次数: 25,865

依赖关系: 0

建议者: 0

安全性: 0

星标: 11

关注者: 3

分支: 16

开放问题: 1

类型:symfony-bundle

2.2.0 2024-04-08 17:31 UTC

README

用于将 H5P 集成到 Symfony 的 Bundle。此 Bundle 是 H5P Drupal 模块的移植版本。有关 H5P 的更多信息,请参阅 H5P.org

此 Bundle 已在以下环境中进行测试

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

先决条件

在运行此安装之前,您需要安装 doctrine annotations 和 orm

composer require orm
composer require doctrine/annotations

安装

使用 composer 安装

composer require jorisdugue/h5p-bundle

AppKernel.php 中启用 Bundle

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

警告:Windows 用户:您需要以管理员身份启动 cmd 或使用 -c 选项

将 H5P 资产添加到 Bundle

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

并重新执行 ...

# 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

向数据库中添加所需的表和关系

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

php bin/console make:migrations

routes.yaml 中启用路由

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

studit_h5p:
  resource: "@StuditH5PBundle/Resources/config/routes.yaml"
  prefix: /

studit_h5p.demo 是可选的。它可以作为在 Symfony 中使用 H5P 的示例以及测试此 Bundle 是否正常工作的方法。

配置

对于 SF4:在 services.yaml 中配置 Bundle。(注意 h5 和 p 之间的下划线)

parameters:
  studit_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

对于 Symfony 5:在 packages > h5pBundle.yml 中配置 Bundle。

studit_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

有关所有配置信息,请参阅 Configuration.php

如果您使用权限,以下是 Bundle 中的当前权限列表

用法

首先添加一个指向您项目的虚拟主机。然后在浏览器中转到 http://<your virtualhost>/h5p/list

待办事项

正在工作

  • 存储使用数据(仅当用户登录时)
  • 下载 H5P
  • 上传 H5P
  • 更新 / 安装 H5P 库
  • 存储使用数据和积分

并非所有内容都已移植。以下事项还需要完成

  • 上传库。目前只能从 Hub 中选择 H5P 默认库。需要自定义 h5p 进行测试。

变更日志

  • 使用带 restrict 标签的开发版本以防止破坏性变更
  • 实现缺失的道路并解决 H5P-editor 的兼容性问题
  • 修复错误并更新 README
  • 修复许多错误 ... 并更新到 SF5 :)
  • 修复缺少链接图片的错误
  • 修复下载包
  • 存储使用数据和积分

开发中

像这样运行静态分析器

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