PHPackages                             nelc/laravel-nelc-xapi-integration - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. nelc/laravel-nelc-xapi-integration

ActiveProject[API Development](/categories/api)

nelc/laravel-nelc-xapi-integration
==================================

xAPI Integration with NELC (National Center for e-Learning)

32.3k5[2 PRs](https://github.com/nelc/laravel-lrs-package/pulls)PHP

Since Aug 5Pushed 1y ago2 watchersCompare

[ Source](https://github.com/nelc/laravel-lrs-package)[ Packagist](https://packagist.org/packages/nelc/laravel-nelc-xapi-integration)[ RSS](/packages/nelc-laravel-nelc-xapi-integration/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Nelc Xapi Integration
=============================

[](#laravel-nelc-xapi-integration)

Laravel package for integrating with Saudi NELC xAPI.

Installation
------------

[](#installation)

Step 1: Navigate to Your Project Directory
------------------------------------------

[](#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
--------------------

[](#step-2-installation)

You can install this library using Composer. Run the following command:

```
composer require nelc/laravel-nelc-xapi-integration
```

Step 3: Register the ServiceProvider
------------------------------------

[](#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
---------------------------

[](#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
-----------------------------------

[](#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
--------------------------------

[](#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
-----

[](#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
--------------------

[](#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
---------------------

[](#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
-----------------

[](#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
-------------------

[](#completed-statement)

Indicates the actor finished or concluded the activity normally.

### Completed (Lesson or class)

[](#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
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c6d5d3f48ce32b910ef68a79251930b8d10bb24e4054553265a04b1fc7947da?d=identicon)[nelc](/maintainers/nelc)

---

Top Contributors

[![lamoud](https://avatars.githubusercontent.com/u/148651072?v=4)](https://github.com/lamoud "lamoud (3 commits)")[![alqahtani](https://avatars.githubusercontent.com/u/226227?v=4)](https://github.com/alqahtani "alqahtani (2 commits)")

### Embed Badge

![Health badge](/badges/nelc-laravel-nelc-xapi-integration/health.svg)

```
[![Health](https://phpackages.com/badges/nelc-laravel-nelc-xapi-integration/health.svg)](https://phpackages.com/packages/nelc-laravel-nelc-xapi-integration)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
