PHP code example of transisidev / laravel-h5p

1. Go to this page and download the library: Download transisidev/laravel-h5p library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

transisidev / laravel-h5p example snippets


use Illuminate\Support\Facades\App;

// Get H5P instance
$h5p = App::make('LaravelH5p');

// Get content by ID
$content = $h5p->get_content($id);

// Get embed code
$embed = $h5p->get_embed($content, $settings);
// Returns: ['embed' => '...', 'settings' => [...]]

// Get editor settings
$settings = $h5p::get_editor();

use Transisi\LaravelH5P\Facades\LaravelH5p;

$content = LaravelH5p::get_content($id);

use Transisi\LaravelH5P\Eloquents\H5pContent;
use Transisi\LaravelH5P\Eloquents\H5pResult;

// Get all content
$contents = H5pContent::all();

// Get content with results
$content = H5pContent::with('results')->find($id);

// Get results for a user
$results = H5pResult::where('user_id', $userId)->get();

use App\Jobs\SendXapiStatement;

SendXapiStatement::dispatch($result);

'language' => 'en',
bash
php artisan h5p:install
bash
php artisan h5p:status
bash
php artisan vendor:publish --tag=laravel-h5p-config
bash
php artisan queue:work
bash
php artisan vendor:publish --tag=laravel-h5p-lang