veridu/idos-sdk-php

This package is abandoned and no longer maintained. No replacement package was suggested.

Veridu idOS PHP SDK.

v1.0.0 2016-10-10 18:04 UTC

This package is not auto-updated.

Last update: 2022-02-01 13:01:50 UTC


README

Installation

This SDK can be found on Packagist.

Is recommended to install this SDK by using composer.

If you are using composer, please edit your composer.json and add the following:

{
    "require": {
        "veridu/idos-sdk-php": "^1.0"
    }
}

To continue with the installation please add these dependencies:

$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install

Examples

You can find examples of basic usage in the samples/ directory.

Bugs and feature requests

Found a Bug? Have a feature request? Please open a new issue.

Before opening any issue, please search for existing issues and read the Issue Guidelines, written by Nicolas Gallagher.

Versioning

This SDK will be maintained under the Semantic Versioning guidelines as much as possible.

Releases will be numbered with the following format:

<major>.<minor>.<patch>

And constructed using the following guidelines:

  • Breaking backward compatibility bumps the major (and resets the minor and patch)
  • New additions without breaking backward compatibility bumps the minor (and resets the patch)
  • Bug fixes and misc changes bumps the patch

For more information on SemVer, please visit http://semver.org/.

Tests

To run the tests, you must install dependencies with composer install --dev.

How To Use The New SDK

The majority of the endpoints require Authentication Tokens when making requests to the API.

There are three kinds of tokens: UserToken, CredentialToken and IdentityToken.

First Step

The first step is to create an auth object, ensuring the constructor has the appropriate credentials for the request.

/**
 * Instantiates an auth object of CredentialToken Class.
 * For each type of Authorization, there is a Class to be instantiated.
 */
$auth = new \idOS\Auth\CredentialToken(
	$credentials['credentialPublicKey'],
	$credentials['handlerPublicKey'],
	$credentials['handlerPrivKey']
);

Second Step

The second step is to instantiate the SDK itself, calling the static create method.

$sdk = \idOS\SDK::create($auth);

Third Step

The third step is to perform the requests to the endpoints. For the time being we only support endpoints related to the user methods. To simplify the SDK and its usage, each fragment of the request is separated into different classes.

/**
 * Making a /GET request to the scores endpoint, listing all scores.
 */
$response = $sdk
    ->Profile($credentials['username']) //passing the username in the Profile Class constructor
    ->Scores->listAll();

/**
 * Making a /POST request to gates endpoint, creating a new gate
 */
$response = $sdk
	->Profile($credentials['username']) //passing the username in the Profile Class constructor
	->Gates->createNew('18+', true);

To see more examples of how to use the SDK and how to call the methods and endpoints, go to the samples/ directory.