PHPackages                             directaff/php-sdk - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. directaff/php-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

directaff/php-sdk
=================

DirectAff php sdk

0.1.1(2y ago)06MITPHP

Since Oct 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/directaff/php-sdk)[ Packagist](https://packagist.org/packages/directaff/php-sdk)[ RSS](/packages/directaff-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

DirectAff PHP SDK Documentation
===============================

[](#directaff-php-sdk-documentation)

Introduction
------------

[](#introduction)

The DirectAff PHP SDK provides a simple interface to interact with the DirectAff API. This SDK offers methods to register, deposit, withdraw, manage bonuses, bet/win actions, and handle chargebacks.

Installation
------------

[](#installation)

This package can be installed via Composer:

```
composer require directaff/php-sdk
```

Configuration
-------------

[](#configuration)

Before making any API calls, ensure you set the base URL, secret API key, and brand ID:

```
use DirectAff\DirectAff;
$directAff = new DirectAff();
$directAff->setBaseUrl('YOUR_API_BASE_URL')
          ->setSecretApiKey('YOUR_SECRET_API_KEY')
          ->setBrandId(YOUR_BRAND_ID);
```

Methods
-------

[](#methods)

### Register

[](#register)

To register a user:

```
$response = $directAff->register([
    'clickId' => 'exampleClickId',
    'identification' => 'exampleUsername', // it can be username or email or phone, userId
    'registration_date' => '2023-01-01 00:00:00'
]);
```

### Register Through Promo Code (offline marketing)

[](#register-through-promo-code-offline-marketing)

To register a user through promo code:

```
$response = $directAff->registerThroughPromoCode([
    'promoCode' => 'examplePromoCode',
    'identification' => 'exampleUsername', // it can be username or email or phone, userId
    'ipAddress' => '127.0.0.1',
    'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)',
    'registration_date' => '2023-01-01 00:00:00'
]);
```

### Deposit

[](#deposit)

To record a deposit:

```
$response = $directAff->deposit([
    'clickId' => 'exampleClickId',
    'amount' => 100,
    'currency' => 'USD',
    'depositId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);
```

### Withdraw

[](#withdraw)

To record a withdrawal:

```
$response = $directAff->withdraw([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'withdrawId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);
```

### Chargeback

[](#chargeback)

To record a chargeback:

```
$response = $directAff->chargeback([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'chargebackId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);
```

### Bonus Added

[](#bonus-added)

To record a bonus added:

```
$response = $directAff->bonusAdded([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'bonusId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);
```

### Bonus Removed

[](#bonus-removed)

To record a bonus removed:

```
$response = $directAff->bonusRemoved([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'bonusId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);
```

### Bet and Win

[](#bet-and-win)

To record bet and win:

```
$response = $directAff->betWin([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'betAmount' => '125.10',
    'winAmount' => '104.25'
]);
```

Error Handling
--------------

[](#error-handling)

Errors from the DirectAff API are returned as associative arrays with a `success` key set to `false` and an `error` key containing the error message.

For example:

```
[
    'success' => false,
    'error' => 'Click not found'
]

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

942d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/88d7934aee11f17908b899c10e4190990d8b5563aa8a2939781b6fddc68b6db6?d=identicon)[ruhul](/maintainers/ruhul)

---

Top Contributors

[![ruhulameen](https://avatars.githubusercontent.com/u/57637494?v=4)](https://github.com/ruhulameen "ruhulameen (3 commits)")

### Embed Badge

![Health badge](/badges/directaff-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/directaff-php-sdk/health.svg)](https://phpackages.com/packages/directaff-php-sdk)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
