PHP Library Quickstart

Configure Project

  1. Add the library module to your project using composer. Add the following in your composer.json
"require": {
    "dapi-co/dapi-php": "^1.3",
},

OR simply type this in your project folder.

composer require dapi-co/dapi-php
  1. Create a DapiClient with your App Secret.
// Assuming that Dapi library is already autoloaded. If not, manually include/require it here.
$dapiClient = new Dapi\DapiClient('APP_SECRET');
  1. Now you can use any of the functions of the products available on the client (data for example) instance to call Dapi. Here is an example for getAccounts.
$accessToken = 'ACCESS_TOKEN'; 
$userSecret = 'USER_SECRET'; 
$accounts = $dapiClient->data->getAccounts($accessToken, $userSecret);
echo PHP_EOL . 'Accounts' . PHP_EOL . PHP_EOL;
echo (json_encode($accounts, JSON_PRETTY_PRINT));