catalin-ionut/profitshare-client

Profitshare modern client to consume the profitshare API.

v1.0.0 2021-12-01 08:11 UTC

This package is auto-updated.

Last update: 2024-04-29 03:10:25 UTC


README

The perfect starting point to integrate Profitshare functionality within your PHP project.

Total Downloads License PHPStan Enabled

✨ Features

  • Thin & minimal API client to interact with Profitshare's API
  • Supports non blocking requests by default
  • Full async methods implemented
  • Easily configurable

💡 Getting Started

First, install Profitshare PHP API Client via the composer package manager:

composer require catalin-ionut/profitshare-client

This package uses json-mapper to map the response to models for type validation and autocomplition.

Then, create the client:

$client = $client = new ProfitshareClient\Profitshare(
    API_USER,
    API_KEY
);

Advertisers

$advertisers = $client->getAdvertisers();

Campaigns

$campaigns = $client->getCampaign($page = 1);

/* full async non blocking */
$callback = function (array $campaigns) {
    var_dump($campaigns);
};
$client->loopAllCampaigns($callback);

Products

$products = $client->getProducts($advertiserID = 113725);

/* full async non blocking */
$callback = function (array $products) {
    var_dump($products);
};
$client->loopAllProducts($advertiserID = 113725, $callback);

Commissions

$filters = [
    'status' => 'approved',
    'date_from' => '2020-06-01',
    'date_to' => '2020-06-23',
];
$commissions = $client->getCommissions($filters);

For full documentation, visit the Profitshare API.

📄 License

Profitshare PHP API Client is an open-sourced software licensed under the MIT license.