Simple Learning Context API Client
This is a PHP implementation for the Learning Context API, (*1)
To use this API, you have to implement a token storage which implements the LearningContextClient\Storage\StorageInterface
. Storage clases using the $_SESSION
array and Zend Session are already provided in LearningContextClient\Storage\SessionArrayStorage
and LearningContextClient\Storage\ZendSessionStorage
respectively., (*2)
To run the Client, you have to create a LearningContextClient\Config
object. It recieves your appId and appSecret, a callback URL which will be called after OAuth authorization and handles the refresh token and an instance of LearningContextClient\Storage\StorageInterface
. It suffices to do any request to the API or to call the LearningContextClient:::getTokenManager
function., (*3)
Create an instance of LearningContextClient\Client
and provide it with your configuration to use the API., (*4)
$storage = new \LearningContextClient\Storage\SessionArrayStorage(); $config = new \LearningContextClient\Config($APP_ID, $APP_SECRET, $CALLBACK_URL, $storage); $lc = new \LearningContextClient\Client($config);
To obtain a token, you simple have to call any API interface or you call the LearningContextClient::getTokenManager
function., (*5)