PHPackages                             dapi-co/dapi-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. dapi-co/dapi-php

ActiveLibrary[API Development](/categories/api)

dapi-co/dapi-php
================

Dapi Client Library for PHP

1.3.0(3y ago)02781[1 PRs](https://github.com/dapi-co/dapi-php/pulls)proprietaryPHPPHP ^7.2.5 || ^8.0

Since Jul 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/dapi-co/dapi-php)[ Packagist](https://packagist.org/packages/dapi-co/dapi-php)[ Docs](https://github.com/dapi-co/dapi-php)[ RSS](/packages/dapi-co-dapi-php/feed)WikiDiscussions prod Synced 1w ago

READMEChangelog (6)Dependencies (1)Versions (9)Used By (0)

dapi-php
========

[](#dapi-php)

A PHP library that talks to the [Dapi](https://dapi.com) [API](https://api.dapi.com).

Quickstart
----------

[](#quickstart)

### Configure Project

[](#configure-project)

First 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
```

### Configure Library

[](#configure-library)

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');
```

2. Now you can use any of the functions of the products available on the client (`data` for example) instance to call Dapi with your `appSecret`.

```
$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));
```

3. Or, you can use the `handleSDKRequests` function of the client instance inside an endpoint in your server. Our code will basically update the request to add your app's `appSecret` to it, and forward the request to Dapi, then return the result.

```
