Repository navigation
Home
LaraLocker is a Laravel API connector for Learning Locker®, the open-source Learning Record Store. It wraps Learning Locker's management API (/api/v2/…) and its xAPI endpoint (/data/xAPI/…). It adds no routes, controllers or tables to your app.
| LaraLocker | PHP | Laravel |
|---|---|---|
| 3.x | 8.2+ | 12, 13 |
| 2.0 branch and master (unmaintained) | 5.6+ | 4.2 – 6 |
| 1.0 branch (unmaintained) | 5.4+ | 4.2 |
Learning Locker v2 or later, self-hosted or SaaS.
composer require ijeffro/laralockerPackage discovery registers the service provider and the LearningLocker and xAPI facades.
In Learning Locker, open Settings → Clients and create a client. Give it API All for the management API and xAPI All (or xAPI read/write) for statements. Then add it to .env:
LEARNING_LOCKER_URL=https://your-learning-locker.example.com
LEARNING_LOCKER_KEY=your-client-key
LEARNING_LOCKER_SECRET=your-client-secretLEARNING_LOCKER_URL is the root of the install, without /api or /data/xAPI.
Optional settings:
.env |
Config key | Default |
|---|---|---|
LEARNING_LOCKER_TIMEOUT |
laralocker.timeout |
30 seconds |
LEARNING_LOCKER_LANGUAGE |
laralocker.xapi.language |
en-GB |
LEARNING_LOCKER_ACTOR_HOMEPAGE |
laralocker.xapi.homepage |
APP_URL |
To edit the config file itself:
php artisan vendor:publish --tag=laralocker-configuse LearningLocker;
LearningLocker::ping(); // true when Learning Locker answers on /api
LearningLocker::clientInfo(); // the client behind the key and secret, with its scopes
LearningLocker::about(); // the xAPI versions the LRS speaksIf clientInfo() throws with a 401, the key or secret is wrong or the client is disabled.
Every model page follows the same pattern. The plural method lists, and the singular method takes an _id:
LearningLocker::stores()->get();
LearningLocker::store($id)->get();
LearningLocker::store()->create($data);
LearningLocker::store($id)->update($data);
LearningLocker::store($id)->delete();Responses are decoded arrays. Failures throw a LearningLockerException. See Errors.
- Querying: filters, sorting, paging, counts, aggregation
- xAPI Statements: sending and reading statements
- Errors: exceptions and faking Learning Locker in tests
- Upgrade guide: moving from the 1.0 and 2.0 branches
Models: Clients · Dashboards · Downloads · Exports · Organisations · Personas · Persona Attributes · Persona Identifiers · Persona Imports · Queries · Roles · Statements · Statement Forwarding · Stores · Users · Visualisations
Enterprise only: Journeys · Journey Progress