escolalms / headless-h5p
无头 H5P Laravel REST API
Requires
- php: >=7.4
- escolalms/auth: ^0
- escolalms/core: ^1
- escolalms/settings: ^0
- h5p/h5p-core: 1.24.*|dev-master
- h5p/h5p-editor: 1.24.*|dev-master
- laravel/framework: >=9.0
Requires (Dev)
- guzzlehttp/guzzle: ^7
- laravel/legacy-factories: ^1.0.4
- nunomaduro/larastan: ^2.0
- orchestra/testbench: ^7.0
- phpunit/phpunit: ^9.0
- dev-main
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.47
- 0.4.46
- 0.4.45
- 0.4.44
- 0.4.43
- 0.4.42
- 0.4.41
- 0.4.40
- 0.4.39
- 0.4.38
- 0.4.37
- 0.4.36
- 0.4.35
- 0.4.34
- 0.4.33
- 0.4.32
- 0.4.31
- 0.4.30
- 0.4.29
- 0.4.28
- 0.4.27
- 0.4.26
- 0.4.25
- 0.4.24
- 0.4.23
- 0.4.22
- 0.4.21
- 0.4.20
- 0.4.19
- 0.4.18
- 0.4.17
- 0.4.16
- 0.4.15
- 0.4.14
- 0.4.13
- 0.4.12
- 0.4.11
- 0.4.10
- 0.4.9
- 0.4.8
- 0.4.7
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.10-patch
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6.7
- 0.3.6.6
- 0.3.6.5
- 0.3.6.4
- 0.3.6.3
- 0.3.6.2
- 0.3.6.1
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.22
- 0.2.21
- 0.2.20
- 0.2.19
- 0.2.18
- 0.2.17
- 0.2.16
- 0.2.15
- 0.2.14
- 0.2.13
- 0.2.12
- 0.2.11
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.2
- 0.1.1
- 0.1.0
- v0.0.10
- v0.0.9
- v0.0.8
- v0.0.7
- v0.0.6
- v0.0.5
- v0.0.4
- v0.0.3
- v0.0.2
- v0.0.1
- dev-feature/h5p-editor-dependency
- dev-release-0.4
- dev-feature/WELLMS-334
- dev-feature/semantic-tags
- dev-feature/php82
- dev-feature/dependencies-fix
- dev-feature/sa
- dev-feature/h5p-version
- dev-feature/fix-tests
- dev-feature/h5p-dev-master
This package is auto-updated.
Last update: 2024-09-19 11:59:19 UTC
README
开始之前
此产品与 Escola LMS 生态系统紧密耦合,且不兼容任何其他 Laravel 应用程序。
工作演示
概念验证演示可在 https://h5p-laravel-demo.stage.etd24.pl/ 查看。
功能
所有功能均通过 REST API 提供,没有使用服务器端渲染的 H5PIntegration global js 变量的 blade 模板,这与 moodle
、drupal
和 wordpress
的 h5p 插件的方法不同。
此软件包仅提供 REST API 访问端点,这是目前唯一允许无头渲染 h5p 的软件包。
功能包括
- 播放所有 h5p 内容 - 提供所有基本数据,但仍需要播放器
- 编辑所有 h5p 内容 - 提供所有基本数据,但仍需要编辑器
- CRUD 库
- CRUD 内容
- 从
.h5p
文件上传库 - 从
.h5p
文件上传内容 - 所有其他 h5p 功能,如导出等
文档
查看 Swagger 记录的端点。
一些 测试 也可以是一个很好的起点。
要播放内容,您可以使用 EscolaLMS H5P Player
演示 React 源文件,是前端教程的绝佳起点
安装
composer require escolalms/headless-h5p
php artisan migrate
php artisan h5p:storage-link
请参阅以下内容php artisan db:seed --class="EscolaLms\HeadlessH5P\Database\Seeders\PermissionTableSeeder"
请参阅以下内容
存储链接
您需要发布许多文件,以便作为公开链接使用。
php artisan h5p:storage-link
创建从 storage/app/h5
、vendor/h5p/h5p-core
和 vendor/h5p/h5p-editor
到公共访问的符号链接,如下所示
public_path('h5p') => storage_path('app/h5p'),
public_path('h5p-core') => base_path().'vendor/h5p/h5p-core',
public_path('h5p-editor') => base_path().'vendor/h5p/h5p-editor',
Cors
所有端点都需要来自其他域的访问,因此必须正确设置 CORS。
除了端点资产外,还必须公开 CORS 标头。您可以通过设置 Apache/Nginx/Caddy/Whatever
设置来实现这一点 - 下面是 Nginx 的全局通配符访问示例。
location ~* \.(eot|ttf|woff|woff2|jpg|jpeg|gif|png|wav|mp3|mp4|mov|ogg|webv)$ {
add_header Access-Control-Allow-Origin *;
}
授权
大多数端点都需要授权,这可以通过 Laravel passport 实现
有一个 seeder 必须运行才能进行授权
用户模型来自 Auth 软件包。
Seeder
为了播种内容和库
php artisan db:seed --class="\EscolaLms\HeadlessH5P\Database\Seeders\ContentLibrarySeeder"
您可以使用内置的种子命令,通过
php artisan h5p:seed
仅添加库php artisan h5p:seed --addContent
添加包含库的内容
路线图
- 以类似于 luminare in typescript 的方式重写 h5p 核心
在本地运行测试
运行 ./test.sh