This is an API wrapper PHP library given as a facility to properly access ADA API. It automatically request an access token to the OAuth2 API endpoint and stores it in PHP session, as well as requesting a new access token when the stored one is found expired.
Using the Ada PHP SDK is as simple as:
-
Clone, Fork or download the source code
-
Configure it with your Swithcer's client_id and secret provided by the ADA platform:
require_once 'src/AdaSdk.php'; $config = array( 'applicationName' => 'YOUR_OWN_APP_NAME', 'clientID'=>'YOUR_CLIENT_ID', 'clientSecret'=>'YOUR_CLIENT_SECRET', 'url'=>'YOUR_ADA_INSTALLATION_URL', 'silentMode'=>true );
The
applicationNameis any string of your own that will identify your application in browser session and basically prevents session variables to overlap. You can comment or setsilentModetofalseto not haveAdaSdkExceptionthrown if an error is returned from the API call. -
Instantiate a new AdaSdk object and use it:
$adasdk = new \ADASdk\AdaSdk($config); /** * load a user in json format */ $user = $adasdk->get('users',array('id'=>A_USER_ID));