msaaq/nelc-laravel

为您的 Laravel 应用程序与沙特 NELC(国家电子学习中心)进行 xAPI 集成

v1.3 2024-04-29 19:17 UTC

This package is auto-updated.

Last update: 2024-08-29 20:01:55 UTC


README

为您的 Laravel 应用程序与沙特 NELC(国家电子学习中心)进行 xAPI 集成

安装

您可以通过 composer 安装此包

composer require msaaq/nelc-laravel

安装包后,您需要在 config/services.php 文件中设置 API 凭证

[
    // ...
    
    'nelc' => [
        'key' => env('NELC_KEY'),
        'secret' => env('NELC_SECRET'),
        'platform' => [
            'name' => env('NELC_PLATFORM_NAME'),
            'identifier' => env('NELC_PLATFORM_IDENTIFIER'),
        ],
        'sandbox' => env('NELC_SANDBOX', false),
    ],
]

用法

现在,您可以使用 Msaaq\NelcLaravel\Nelc 门面向 NELC 发送 xAPI 语句

use Msaaq\NelcLaravel\Nelc;

app(Nelc::class)->sendStatement($statement);

或者

use Nelc;

Nelc::sendStatement($statement);

或者从您的控制器中这样做

use Msaaq\NelcLaravel\Nelc;

class MyController extends Controller
{
    public function index(Request $request, Nelc $nelc)
    {
        $nelc->sendStatement($statement);
    }
}

语句

有关语句的更多信息,请访问 nelc-xapi-php-sdk