1. Go to this page and download the library: Download petersons/d2l-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
petersons / d2l-client example snippets
use Petersons\D2L\AuthenticatedUriFactory;
use Petersons\D2L\DTO\Enrollment\CreateEnrollment;
use Petersons\D2L\SymfonyHttpClient;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpClient\ScopingHttpClient;
$client = new SymfonyHttpClient(
ScopingHttpClient::forBaseUri(
HttpClient::create(),
'https://petersonstest.brightspace.com',
),
new AuthenticatedUriFactory(
'https://petersonstest.brightspace.com',
'appId',
'appKey',
'lmsUserId',
'lmsUserKey',
),
'orgId',
'installationCode',
'pKey',
'apiLpVersion', // e.g. 1.30
'apiLeVersion', // e.g. 1.53
);
$client->enrollUser(new CreateEnrollment(1, 2, 3));