2017 © Pedro Peláez
 

library dislo-sdk

Client library for Dislo APIs

image

ixolit/dislo-sdk

Client library for Dislo APIs

  • Monday, July 23, 2018
  • by friegler
  • Repository
  • 7 Watchers
  • 2 Stars
  • 555 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 51 Versions
  • 2 % Grown

The README.md

ixoplan-sdk

PHP SDK for the Ixoplan API, (*1)

Installation

Simply add ixolit/ixoplan-sdk and a provider of ixolit/ixoplan-sdk-http (e.g. ixolit/ixoplan-sdk-http-guzzle) to your composer.json, e.g:, (*2)

{
    "name": "myvendor/myproject",
    "description": "Using ixoplan-sdk",
    "require": {
        "ixolit/ixoplan-sdk": "*",
        "ixolit/ixoplan-sdk-http-guzzle": "*"
    }
}

Usage

Instantiate the Client

The client is designed for different transport layers. It needs a RequestClient interface (e.g. HTTPRequestClient) to actually communicate with Ixoplan., (*3)

use Ixolit\Dislo\Client;
use Ixolit\Dislo\HTTP\Guzzle\GuzzleHTTPClientAdapter;
use Ixolit\Dislo\Request\HTTPRequestClient;

$httpAdapter = new GuzzleHTTPClientAdapter();

$httpClient = new HTTPRequestClient(
    $httpAdapter,
    $host,
    $apiKey,
    $apiSecret
);

$apiClient = new Client($httpClient);

Most methods related to user data can be used with either a user ID, a \Ixolit\Dislo\WorkingObjects\User object or an authentication token. However, the less secure options have to be requested explicitely by passing $forceTokenMode = false to the constructor. Don't use this option unless you really need it, e.g. for implementing administrative functionality., (*4)

Login

Authenticate user, retrieve token and user data:, (*5)

$apiClient = new \Ixolit\Dislo\Client($httpClient);

try {
    $authResponse = $apiClient->userAuthenticate(
        $userEmail,
        $password,
        $ipAddress
    );

    $authToken = $authResponse->getAuthToken();
    setcookie('authToken', $authToken);

    $user = $response->getUser();
    echo $user->getLastLoginDate();
}
catch (\Ixolit\Dislo\Exceptions\AuthenticationInvalidCredentialsException $e) {
    // invalid credentials
    echo $e->getMessage();
}

Get user from token:, (*6)

$token = getcookie('authToken');

$apiClient = new \Ixolit\Dislo\Client($httpClient);

try {
    $user = $apiClient->userGet($token);
}
catch (\Ixolit\Dislo\Exceptions\InvalidTokenException $e) {
    // token invalid, e.g. expired
    setcookie('authToken', null, -1);
}
catch (\Ixolit\Dislo\Exceptions\DisloException $e) {
    // other, e.g. missing arguments
}

A token's expiry time is extended automatically on usage., (*7)

Verify a token, explicitly extend its expiry time and optionally change its lifetime:, (*8)

$token = getcookie('authToken');

$apiClient = new \Ixolit\Dislo\Client($httpClient);

try {
    $response = $apiClient->userExtendToken($token, $ipAdress, 3600);
    $authToken = $response->getAuthToken();
    echo $authToken->getValidUntil()->format('c');
}
catch (\Ixolit\Dislo\Exceptions\InvalidTokenException $e) {
    // token invalid, e.g. expired
    setcookie('authToken', null, -1);
}
catch (\Ixolit\Dislo\Exceptions\DisloException $e) {
    // other, e.g. missing arguments
}

Deauthenticate:, (*9)

$apiClient->userDeauthenticate($token);
setcookie('authToken', null, -1);

Packages

Retrieve a list of packages, optionally filtered by service ID:, (*10)

$apiClient = new \Ixolit\Dislo\Client($httpClient);

$response = $apiClient->packagesList("1");

foreach ($response->getPackages() as $package) {
    echo $package->getDisplayNameForLanguage('en')->getName(), "\n";
}

Subscriptions

Retrieve a list of subscriptions for a user:, (*11)

$apiClient = new \Ixolit\Dislo\Client($httpClient);

$response = $apiClient->subscriptionGetAll($token);

foreach ($response->getSubscriptions() as $subscription) {
    print_r([
        'status' => $subscription->getStatus(),
        'active' => $subscription->isActive(),
        'startedAt' => $subscription->getStartedAt()->format('c'),
        'package' => $subscription->getCurrentPackage()->getDisplayNameForLanguage('en')->getName(),
        'price (EU)' => $subscription->getCurrentPeriod()->getBasePriceForCurrency('EUR')->getAmount(),
        'metaData' => $subscription->getProvisioningMetaData(),
    ]);
}

Search API

Run a parametrized query against the search database in Ixoplan, pass a file resource to stream the returned data to., (*12)

$apiClient = new \Ixolit\Dislo\Client($httpClient);

$date = date('Y-m-d');
$file = fopen('/path/to/file', 'w');

$apiClient->exportStreamQuery(
    'select * from users where last_indexed_at > :_last(date)',
    ['last' => $date],
    $file
);

The Versions

23/07 2018

dev-master

9999999-dev

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

23/07 2018

v1.0.39

1.0.39.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

17/05 2018

v1.0.38

1.0.38.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

27/04 2018

v1.0.37

1.0.37.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

25/04 2018

v1.0.36

1.0.36.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

22/03 2018

dev-feature/dschobert/workingobjects-custom

dev-feature/dschobert/workingobjects-custom

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

21/02 2018

dev-feature/mmarchewa/workingobjects-custom

dev-feature/mmarchewa/workingobjects-custom

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

21/02 2018

v1.0.35

1.0.35.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

19/02 2018

dev-beta

dev-beta

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

29/01 2018

v1.0.34

1.0.34.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

26/01 2018

v1.0.33

1.0.33.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

25/01 2018

v1.0.32

1.0.32.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

25/01 2018

v1.0.31

1.0.31.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

09/01 2018

v1.0.30

1.0.30.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

28/12 2017

v1.0.29

1.0.29.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

12/12 2017

dev-feature/odala/abstractclient

dev-feature/odala/abstractclient

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

07/12 2017

v1.0.28

1.0.28.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

06/12 2017

v1.0.27

1.0.27.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

03/10 2017

dev-feature/dschobert/requireFlexibleForFreeSignup

dev-feature/dschobert/requireFlexibleForFreeSignup

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

03/10 2017

v1.0.26

1.0.26.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

28/09 2017

dev-feature/mmarchewa/mail-open-tracking-v2

dev-feature/mmarchewa/mail-open-tracking-v2

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

21/08 2017

v1.0.25

1.0.25.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

16/08 2017

v1.0.24

1.0.24.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

14/08 2017

v1.0.23

1.0.23.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

10/08 2017

v1.0.22

1.0.22.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

08/08 2017

v1.0.21

1.0.21.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

07/08 2017

v1.0.20

1.0.20.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

03/08 2017

v1.0.19

1.0.19.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

03/08 2017

v1.0.18

1.0.18.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

24/07 2017

v1.0.17

1.0.17.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

20/07 2017

v1.0.16

1.0.16.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

19/07 2017

v1.0.15

1.0.15.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

05/07 2017

v1.0.14

1.0.14.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

28/06 2017

v1.0.13

1.0.13.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

29/05 2017

v1.0.12

1.0.12.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

24/05 2017

v1.0.11

1.0.11.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

24/05 2017

v1.0.10

1.0.10.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

23/05 2017

dev-feature/refactoring

dev-feature/refactoring

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

22/05 2017

v1.0.9

1.0.9.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

24/04 2017

dev-feature/phoneVerificationWithoutUser

dev-feature/phoneVerificationWithoutUser

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

24/04 2017

v1.0.8

1.0.8.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

24/04 2017

dev-feature/billingEventModifiedAt

dev-feature/billingEventModifiedAt

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

21/04 2017

v1.0.7

1.0.7.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

19/04 2017

v1.0.6

1.0.6.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

03/04 2017

dev-mmarchewa/no-cde

dev-mmarchewa/no-cde

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

03/04 2017

v1.0.5

1.0.5.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

03/04 2017

v1.0.4

1.0.4.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

29/03 2017

v1.0.3

1.0.3.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

28/03 2017

v1.0.2

1.0.2.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

24/03 2017

v1.0.1

1.0.1.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires

28/02 2017

v1.0.0

1.0.0.0

Client library for Dislo APIs

  Sources   Download

MIT

The Requires

  • ixolit/dislo-sdk-http ^1.0

 

The Development Requires