A PHP wrapper around the Tapfiliate API
Install http://getcomposer.org/ and run the following command:
php composer.phar require tapfiliate/sdk-php
- Configure an ApiClient
- Configure handler which will perform an action
You just need to fill in the required arguments
$logger = new NullLogger();
$helper = new ModelFiller();
$api = new ApiClient($logger, '<Your 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 key
text field
By default, it's set to: https://api.tapfiliate.com
But you can modify host by adding your own data to ApiClient
constructor
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.