Vipip SDK
Vipip SDK for PHP, (*1)
, (*2)
# Table of contents
- Installation
- Usage
-
Modules
- Service methods
# Installation
It is recommended that you install the Vipip SDK library through composer. To do so, add the following lines to your composer.json
file., (*3)
{
"require": {
"ferrumfist/vipip_sdk": "~0.1"
}
}
# Usage
At the beginning of the library must be initialized by calling the init method, (*4)
VipIP::init(<access_token>[, $config]);
The following options can be passed as a configuration:, (*5)
[
'lang'=>'ru',
'cache' => [
'driver' => 'redis',
'config' => [
'host' => '127.0.0.1',
'port' => '6379'
]
]
More information about the cache options, click here, (*6)
# Modules
SDK is divided into modules. You get the module to perform API requests, (*7)
$user = VipIP::module('user');
User
getBalance - getting user`s balance, (*8)
$user->getBalance();
getDiscount - getting user`s discount, (*9)
$user->getDiscount();
Services
Services it is a group of modules which includes Link, Task, Social, (*10)
create - creating services, (*11)
$link = VipIP::module('link')->create("My first link", "http://example.com");
getList, getOne- getting list of/one service(s), (*12)
$links = VipIP::module('link')->getList([43,648,474]);
$link = VipIP::module('link')->getOne(45);
Service methods
After creating/getting the service you have the object of service. To use a service, use the following methods:, (*13)
save - saving attributes of service, (*14)
$link->save([
'title' => 'new titile',
'url' => 'http://new_url.org'
]);
changeBalance - changing service balance, (*15)
changeStatus - changing service status
example, (*16)
if( !$link->changeBalance(3, \Vipip\Service\Service::BALANCE_TYPE_DAYS) ){
echo $link->getLastError();
}
The next group of methods gets / sets the objects for the service settings, (*17)
getTariff - getting tariff, (*18)
setTariff - setting tariff, (*19)
getInputReferer - getting inputpoints and referers, (*20)
setInputReferer - Setting inputpoints and referers, (*21)
getGeo - getting geography settings, (*22)
setGeo - setting geography settings, (*23)
getCalendar - getting calendar settings, (*24)
setCalendar - setting calendar settings, (*25)