al-saloul/laravel-nelc-xapi-integration
Composer 安装命令:
composer require al-saloul/laravel-nelc-xapi-integration
包简介
xAPI Integration with NELC (National Center for e-Learning)
README 文档
README
Laravel package for integrating with Saudi NELC xAPI.
Installation
Step 1: Navigate to Your Project Directory
Before you begin, navigate to the directory where your Laravel project is located. Use the following command to change into your project directory:
cd path/to/your/laravel-project
Step 2: Installation
You can install this library using Composer. Run the following command:
composer require al-saloul/laravel-nelc-xapi-integration
Step 3: Register the ServiceProvider
Register the NelcXapiServiceProvider in your Laravel project. Open the config/app.php file and add the following line to the providers array:
// config/app.php 'providers' => ServiceProvider::defaultProviders()->merge([ /* * Package Service Providers... */ // Other providers... Nelc\LaravelNelcXapiIntegration\NelcXapiServiceProvider::class, ])->toArray(),
Step 4: Dump Autoload Files
After registering the ServiceProvider, run the following command to re-generate Composer's autoloader files:
composer dump-autoload
Step 5: Publish Configuration Files
To publish the configuration files provided by this package, run the following Artisan command:
php artisan vendor:publish --provider="Nelc\LaravelNelcXapiIntegration\NelcXapiServiceProvider"
This will deploy asset files inside the public folder with the name lrs-nelc-xapi and the file lrs-nelc-xapi.php inside the config folder.
Step 6: Configure Basic Settings
To start using this package, follow these steps to configure the basic settings and connect with NELC XAPI:
Add your LRS_ENDPOINT and LRS_USERNAME and LRS_PASSWORD to projects .env file
# .env file content
LRS_ENDPOINT=provided_lrs_endpoint
LRS_USERNAME=your_lrs_username
LRS_PASSWORD=your_lrs_password
If needed you can open the lrs-nelc-xapi.php file inside the config folder. Adjust the basic settings according to your requirements. Make sure to set up any authentication (key, secret) details through .env file to avoid these sensitive being commited to git repo and being exposed.
// config/lrs-nelc-xapi.php return [ 'endpoint' => env('LRS_ENDPOINT'), 'middleware' => ['web'], // Middleware to display the demo page, ['web', 'auth', ...] 'key' => env('LRS_USERNAME'), 'secret' => env('LRS_PASSWORD'), 'platform_in_arabic' => '', // Platform name in Arabic 'platform_in_english' => '', // Platform name in English 'base_route' => 'nelcxapi/test', // Demo Page Link ];
Now, you can go to the demo page and start testing statement submissions using the following link:
https://your-site.com/nelcxapi/test or through the route('lrs-nelc-xapi.base_route').
Usage
Once the package is installed and the ServiceProvider is registered, you can use it in your Laravel project. Here's a simple examples:
Registered Statement
Indicates the actor is officially enrolled or inducted in an activity.
use Nelc\LaravelNelcXapiIntegration\XapiIntegration; // ... $xapi = new XapiIntegration(); $response = $xapi->Registered( '123456789', // Student National ID 'betalamoud@gmail.com', // Student Email '123', // Course Id OR url Or slug 'New Course', // Course Title 'New Course description', // Course description 'MR Hassan', // instructor Name 'mrhassan@mail.com', // instructor Email ); // dd( $response['status'] ); return 200 // dd( $response['message'] ); return ok // dd( $response['body'] ); return UUID
Initialized Statement
Indicates the activity provider has determined that the actor successfully started an activity.
use Nelc\LaravelNelcXapiIntegration\XapiIntegration; // ... $xapi = new XapiIntegration(); $response = $xapi->Initialized( '123456789', // Student National ID 'betalamoud@gmail.com', // Student Email '123', // Course Id OR url Or slug 'New Course', // Course Title 'New Course description', // Course description 'MR Hassan', // instructor Name 'mrhassan@mail.com', // instructor Email ); // dd( $response['status'] ); return 200 // dd( $response['message'] ); return ok // dd( $response['body'] ); return UUID
Watched Statement
Indicates that the actor has watched the object. This verb is typically applicable only when the object represents dynamic, visible content such as a movie, a television show or a public performance. This verb is a more specific form of the verbs experience, play and consume.
use Nelc\LaravelNelcXapiIntegration\XapiIntegration; // ... $xapi = new XapiIntegration(); $response = $xapi->Watched( '123456789', // Student National ID 'betalamoud@gmail.com', // Student Email '/url/to/lesson', // Lesson Or object URL 'Lesson title', // Object title 'Lesson description', // Object description true, // The status indicating whether it has been fully watched (boolean). 'PT15M', // The duration of the watching session in `ISO 8601` format. '123', // Course Id OR url Or slug 'New Course', // Course Title 'New Course description', // Course description 'MR Hassan', // instructor Name 'mrhassan@mail.com', // instructor Email ); // dd( $response['status'] ); return 200 // dd( $response['message'] ); return ok // dd( $response['body'] ); return UUID
Completed Statement
Indicates the actor finished or concluded the activity normally.
Completed (Lesson or class)
use Nelc\LaravelNelcXapiIntegration\XapiIntegration; // ... $xapi = new XapiIntegration(); $response = $xapi->CompletedLesson( '123456789', // Student National ID 'betalamoud@gmail.com', // Student Email '/url/to/lesson', // Lesson URL 'Lesson title', 'Lesson description', '123', // Course Id OR url Or slug 'New Course', // Course Title 'New Course description', // Course description 'MR Hassan', // instructor Name 'mrhassan@mail.com', // instructor Email ); // dd( $response['status'] ); return 200 // dd( $response['message'] ); return ok // dd( $response['body'] ); return UUID
al-saloul/laravel-nelc-xapi-integration 适用场景与选型建议
al-saloul/laravel-nelc-xapi-integration 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「xAPI」 「NELC xAPI Integration」 「NELC Saudi」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 al-saloul/laravel-nelc-xapi-integration 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 al-saloul/laravel-nelc-xapi-integration 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 al-saloul/laravel-nelc-xapi-integration 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
common exception classes for Experience API implementations
common test data fixtures for Experience API related packages
common JSON test fixtures for Experience API related packages
abstract definition of an xAPI repository interface
client library for the Experience API (xAPI)
A framework for TRAX LRS
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-22