PHP code example of jiangwang / ad-ocean-sdk

1. Go to this page and download the library: Download jiangwang/ad-ocean-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jiangwang / ad-ocean-sdk example snippets


$app = \AdOceanSdk\Application::init();
$app->client()
    ->setInterceptor(new \AdOceanSdk\RequestClientInterceptor()) //可以继承,拦截响应
    ->setAccessToken('你的token');
// 调用API
$response = $app->apis()->openAdvertiserAvatarGetApi(\AdOceanSdk\Advertiser\Params\AdvertiserAvatarGetParams::from([])); //也可以直接传入数组
// 获取数据
$response->getData();
// 获取数组
$response->getData()->toArray();

$app = \AdOceanSdk\Application::init();

class CustomApi extends \AdOceanSdk\RequestApi {}

class CustomParams extends  \AdOceanSdk\RequestParams {}

// 传入自定义的API类和方法类
$app->client()->call(new CustomApi(), new CustomParams::from([]));
// 也可以通过API类直接调用
(new CustomApi())->call([]);