werkspot/bing-ads-api-bundle

此包已被废弃,不再维护。未建议替代包。

一个在 Symfony 中调用 Bing Ads API 的服务

安装: 18

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

v0.0.2-beta.1 2016-03-07 13:58 UTC

This package is auto-updated.

Last update: 2020-10-21 07:19:19 UTC


README

BingAdsApiBundle 为您的 Symfony 项目提供了一个简单的 Bing Ads API 集成。

查看 Bing Ads 完整 文档

警告:目前处于开发中

Build Status Scrutinizer Code Quality Code Coverage

待办事项

  • 创建更多报告

安装

使用 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 开发。