PHP code example of intelliscl / sdk
1. Go to this page and download the library: Download intelliscl/sdk 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/ */
intelliscl / sdk example snippets
$authUrl = \Intellischool\OAuth2::getAuthUrl(
'your_client_id',
'https://your.redirect.uri/callback',
['openid', 'offline_access', 'sync_agent', 'lti_launch']
);
header('Location: '.$authUrl);
$tokenStore = \Intellischool\OAuth2::exchangeCodeForToken(
$_GET['code'],
'https://your.redirect.uri/callback',
'your_client_id',
'your_client_secret'
);
$token = (new \Intellischool\LTI\LaunchToken())->setIssuer('https://lms.school.edu')
->setDeploymentId('test_deployment_id')
->setSubject('[email protected] ')
->setName('Ms Jane Marie Doe')
->setGivenName('Jane')
->setMiddleName('Marie')
->setFamilyName('Doe')
->setEmail('[email protected] ')
->setPicture('https://lms.school.edu/jane.jpg')
->setRole('http://purl.imsglobal.org/vocab/lis/v2/institution/person#Student')
->setTargetLinkUri('https://analytics.intellischool.cloud/dashboard/12345')
->setResourceLink(0)
->setLaunchPresentation('iframe');
$encodedToken = $token->build($key);
$agent = \Intellischool\SyncAgent::createWithIdAndSecret('deployment_id','deployment_secret');
$agent = \Intellischool\SyncAgent::createWithOAuth2($tokenStore, 'your_client_id', 'your_client_secret');
$syncs = $agent->doSync();