Giter Site home page Giter Site logo

idos-sdk-php's Introduction

Veridu idOS PHP SDK

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": "@stable(what version is it going to be?)"
    }
}

To continue with the installation please add this dependencies:

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

Examples

You can find examples of basic usage on src/codeSamples/ 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 with 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 or IdentityToken.

First Step

The first step is to create an auth object passing through its constructor the credentials necessary for the request intended.

/**
 * Instantiates an auth object of CredentialToken Class.
 * Foreach 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 method create

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

Third Step

The third step to perform is the requests to the endpoints. At the time being we only support endpoints related to the users methods. To simplify the SDK and its usage,every fragment of the request is separated in different classes.

/**
 * Making a /GET request to 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 src/codeSamples directory.

idos-sdk-php's People

Contributors

flavioheleno avatar alvaropmello avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.