werkspot / bing-ads-api-bundle
此包已被废弃,不再维护。未建议替代包。
一个在 Symfony 中调用 Bing Ads API 的服务
v0.0.2-beta.1
2016-03-07 13:58 UTC
Requires
- php: >=5.3.2
- cpcstrategy/bing-ads-sdk-php: ~2.0
- guzzlehttp/guzzle: ~6.1
- symfony/framework-bundle: ~2.3|~3.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ^5.2
This package is auto-updated.
Last update: 2020-10-21 07:19:19 UTC
README
BingAdsApiBundle 为您的 Symfony 项目提供了一个简单的 Bing Ads API 集成。
查看 Bing Ads 完整 文档
警告:目前处于开发中
待办事项
- 创建更多报告
安装
使用 composer,添加
{ "require": { "werkspot/bing-ads-api-bundle": "dev-master" } }
然后在您的内核中启用它
// app/AppKernel.php public function registerBundles() { $bundles = [ //... new Werkspot\BingAdsApiBundle\WerkspotBingAdsApiBundle(), //...
配置
# app/config/config.yml # Bing ads API werkspot_bing_ads_api: cache_dir: "%kernel.cache_dir%" #<-- optional
使用方法
此包注册了 werkspot.bing_ads_api_client
服务,允许您调用 API;
获取报告
use BingAds\Reporting\ReportTimePeriod; $reportType = 'GeoLocationPerformanceReportRequest'; $timePeriod = ReportTimePeriod::LastMonth; $columns = [ 'TimePeriod', 'AccountName', 'AdGroupId', 'AdGroupName', 'Impressions', 'Clicks', 'CurrencyCode', 'Spend', 'Country', 'City', 'State', 'MetroArea', 'MostSpecificLocation', ]; $apiDetails = new ApiDetails( 'refreshToken', 'clientId', 'secret', 'redirectUri', 'devToken' ); $bingApi = $this->get('werkspot.bing_ads_api_client'); $bingApi->setApiDetails($apiDetails); $arrayOfFiles = $bingApi->get($columns, $reportType, $timePeriod ); /* [...] Do something with the list */ $bingApi->clearCache(); //-- When done remove the files $newRefreshToken = $bingApi->getRefreshToken() //-- Get new RefreshToken
致谢
BingAdsApiBundle 基于官方的 Bing Ads API。BingAdsApiBundle 由 LauLaman 开发。