2017 © Pedro Peláez
 

library l2p-client

Simple L2P API Client

image

xelax90/l2p-client

Simple L2P API Client

  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

L²P API Client

This is a PHP implementation for the L²P API., (*1)

Token Storage

To use this API, you have to implement a token storage which implements the L2PClient\Storage\StorageInterface. A Storage class using Zend Session is already provided in L2PClient\Storage\ZendSessionStorage., (*2)

Configuration

To run the Client, you have to create a L2PClient\Config object. It recieves an instance of StorageInterface and the ClientID which is provided to you by the IT Center., (*3)

Usage

Create an instance of L2PClient\Client and provide it with your configuration to use the API., (*4)

$storage = new L2PClient\Storage\ZendSessionStorage();
$config = new L2PClient\Config($storage, 'CLIENT_ID');
$client = new L2PClient\Client($config);

Obtain token

To obtain an access token, you have to call the getAccessToken method. On the first call it will return null, since you have to get a RefreshToken first. There will be a DeviceToken stored in in the storage, that you can use to show the verification url to the user:, (*5)

$token = $client->getAccessToken();
if($token === null){
    $deviceToken = $config->getStorage()->getDeviceToken();
    $verificationUrl = $deviceToken->buildVerificationUrl();
    sprintf('<a href="%s" target="_blank">Verify here</a>', $verificationUrl);
}

After the verification is done, the next call to getAccessToken will return an L2PClient\Token\AccessToken., (*6)

Calling the API

After you successfully recieved an AccessToken, you can use the request function to access the API:, (*7)

var_dump($client->request('viewAllCourseInfo'));

The Versions

02/03 2016

dev-master

9999999-dev

Simple L2P API Client

  Sources   Download

BSD-2-Clause

The Requires

  • ext-curl *

 

by Aleksandr

20/01 2016

v0.1.1

0.1.1.0

Simple L2P API Client

  Sources   Download

BSD-2-Clause

The Requires

  • ext-curl *

 

by Aleksandr

20/01 2016

0.1

0.1.0.0

Simple L2P API Client

  Sources   Download

BSD-2-Clause

The Requires

  • ext-curl *

 

by Aleksandr