ferrumfist / vipip_sdk
PHP SDK for work with Vipip service
Requires
- php: >=5.4.0
- phpfastcache/phpfastcache: ^6.0
This package is not auto-updated.
Last update: 2024-11-09 21:10:15 UTC
README
Vipip SDK for PHP
Table of contents
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.
{ "require": { "ferrumfist/vipip_sdk": "~0.1" } }
Usage
At the beginning of the library must be initialized by calling the init method
VipIP::init(<access_token>[, $config]);
The following options can be passed as a configuration:
[ 'lang'=>'ru', 'cache' => [ 'driver' => 'redis', 'config' => [ 'host' => '127.0.0.1', 'port' => '6379' ] ]
More information about the cache options, click here
Modules
SDK is divided into modules. You get the module to perform API requests
$user = VipIP::module('user');
User
getBalance - getting user`s balance
$user->getBalance();
getDiscount - getting user`s discount
$user->getDiscount();
Services
Services it is a group of modules which includes Link, Task, Social
create - creating services
$link = VipIP::module('link')->create("My first link", "http://example.com");
getList, getOne- getting list of/one service(s)
$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:
save - saving attributes of service
$link->save([ 'title' => 'new titile', 'url' => 'http://new_url.org' ]);
changeBalance - changing service balance
changeStatus - changing service status example
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
getTariff - getting tariff
setTariff - setting tariff
getInputReferer - getting inputpoints and referers
setInputReferer - Setting inputpoints and referers
getGeo - getting geography settings
setGeo - setting geography settings
getCalendar - getting calendar settings
setCalendar - setting calendar settings