The easiest way to implement OpenLRW into your PHP applications (the documentation is not finished)
Client aimed to request the OpenLRW API in an easy way but also to manipulate objects from these requests.
- PHP >= 5.6
$ composer require openlrw/api-client
use OpenLRW\OpenLRW;
$client = new OpenLRW(URL, KEY, PASSWORD);
$isServerUp = OpenLRW::isUp();
OpenLRW::generateJwt();
All the OneRoster models are not yet implemented, send an issue to let us know if you need a new collection
All the OneRoster models have those functions
// Get and edit a user
$user = User::find('foobar');
$user->status = 'active';
$user->save();
// Create a new user
$user = new User();
$user->sourcedId = 'foo';
$user->name = 'bar';
$user->status 'inactive';
$user->save();
// Delete a user
$user->delete(); /** or */ User::destroy('foo-bar');
// Get all the users
$users = Users::all();
Check the classes to know all those specific functions
/** Klass model */
$enrollments = Klass::enrollments($classId); // array
$events = Klass::events($classId); // array
// ...
/** Risk */
$latestRisk = Risk::latestByClassAndUser($classId, $userId); // Risk::class
// ...
$user = OneRoster::httpGet('users/test2u'); // return an array
$jsonInArray = ['...'];
$response = OneRoster::httpPost('users', $jsonInArray);
Since it is an API Client, you will have to edit the credentials in order to log onto the API
\vendor\bin\phpunit.bat --bootstrap vendor\autoload.php tests\ApiClientTest.php