jiangwang / ad-ocean-sdk
巨量广告 PHP SDK
1.2.8
2024-10-29 06:42 UTC
Requires
- php: >=8.1
- guzzlehttp/guzzle: ^7.5.0
- yzen.dev/plain-to-class: 3.0.3
Requires (Dev)
- phpunit/phpunit: ^10.4
README
使用示例
简单使用
$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();
自定义API
$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([]);