1ff / tapfiliate-php-sdk
Client for tapfiliate.com
Installs: 348
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 2
pkg:composer/1ff/tapfiliate-php-sdk
Requires
- ext-curl: *
 - psr/log: ^3.0
 
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.13
 - phpstan/phpstan: ^1.8
 - phpunit/phpunit: ^9.5
 
README
A PHP wrapper around the Tapfiliate API
Install
Install http://getcomposer.org/ and run the following command:
php composer.phar require 1ff/tapfiliate-php-sdk
PHP SDK Configuration
To use SDK you need:
- Configure an ApiClient
 - Configure handler which will perform an action
 
How to configure an ApiClient?
You just need to fill in the required arguments
$logger = new NullLogger(); $helper = new ModelFiller(); $api = new ApiClient($logger, '<Your API key>');
How to get an API key? 
- Go to Tapfiliate platform.
 - Login to your publisher account.
 - Click on your account image.
 - Then choose 
Profile settings > API key - And copy the value from 
API keytext field 
How to get a Tapfiliate host? 
By default, it's set to: https://api.tapfiliate.com 
But you can modify host by adding your own data to ApiClient constructor
How to configure a handler?
Example of ClicksHandler configuration:
$clickHandler = new ClicksHandler($api, $helper);
Example of click creation:
$clicks = new Click(); // You can set specific data to Click model (e.g referral code) $clicks->setReferralCode('<referral code>'); $clickHandler->createClick($clicks);
After executing createClick action it will return a Clicks object filled with API response. 
Example of response:
object(Tapfiliate\Models\Click) { ["id":"Tapfiliate\Models\Click":private]=> string(36) "<click id>" ["referralCode":"Tapfiliate\Models\Click":private]=> string(6) "<referral code>" ["sourceId":"Tapfiliate\Models\Click":private]=> NULL ["referrer":"Tapfiliate\Models\Click":private]=> NULL ["landingPage":"Tapfiliate\Models\Click":private]=> NULL ["userAgent":"Tapfiliate\Models\Click":private]=> NULL ["ip":"Tapfiliate\Models\Click":private]=> NULL ["metaData":"Tapfiliate\Models\Click":private]=> array(0) { } }
If something goes wrong ClicksHandler will throw an exception.