intelliscl / sdk
Intellischool SDK for PHP
Requires
- php: >=7.4
- ext-json: *
- ext-pdo: *
- firebase/php-jwt: ^5.4
- guzzlehttp/guzzle: ^7.0
- guzzlehttp/psr7: ^1.8.2
- kamermans/guzzle-oauth2-subscriber: ^1.0.8
- microsoft/azure-storage-blob: ^1.5.2
- psr/log: ^1.1.4
Suggests
- ext-openssl: For Launch Token signing
- ext-pdo_mysql: For MySQL databases
- ext-pdo_pgsql: For Postgre databases
- ext-pdo_sqlsrv: For MsSQL databases
This package is auto-updated.
Last update: 2025-03-15 11:28:02 UTC
README
This SDK has been developed to provide Intellischool partners with a simple and quick means to integrate with our products.
This is an evolving project. Please report any issues using GitHub.
Installation
composer require intelliscl/sdk
Quickstart
Auth
To initiate an OAuth2 flow:
$authUrl = \Intellischool\OAuth2::getAuthUrl( 'your_client_id', 'https://your.redirect.uri/callback', ['openid', 'offline_access', 'sync_agent', 'lti_launch'] ); header('Location: '.$authUrl);
At your callback/redirect endpoint:
$tokenStore = \Intellischool\OAuth2::exchangeCodeForToken( $_GET['code'], 'https://your.redirect.uri/callback', 'your_client_id', 'your_client_secret' );
$tokenStore
will be populated with a JSON object that you can save in a very safe place for use with other endpoints.
LTI Launch
To create an LTI Launch token with the given parameters:
$token = (new \Intellischool\LTI\LaunchToken())->setIssuer('https://lms.school.edu') ->setDeploymentId('test_deployment_id') ->setSubject('jane@school.edu') ->setName('Ms Jane Marie Doe') ->setGivenName('Jane') ->setMiddleName('Marie') ->setFamilyName('Doe') ->setEmail('jane@school.edu') ->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);
Note: Roles must be a valid LIS role as per the LTI specification.
Once your token has been generated, it should be POST
ed in the id_token
field to our LTI endpoint from the browser:
https://core.intellischool.net/auth/lti
Data synchronisation
The SDK includes a simple version of Intellischool's Sync Agent that automatically synchronises supported local data sources to the Intellischool Data Plaftorm.
Instantiation
To instantiate the Sync Agent using a deployment ID and secret:
$agent = \Intellischool\SyncAgent::createWithIdAndSecret('deployment_id','deployment_secret');
To instantiate the Sync Agent using an OAuth2 token store and your client id & secret:
$agent = \Intellischool\SyncAgent::createWithOAuth2($tokenStore, 'your_client_id', 'your_client_secret');
Executing sync jobs
To run a data synchronisation using the Sync Agent:
$syncs = $agent->doSync();
Jobs are managed by the Intellischool Data Platform. Depending on the size of the job(s) the sync process may take seconds to hours. You should ensure that this job is run in the background of your app.