werkspot/bing-ads-api-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

A service to make API calls to bing ads in Symfony

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

The BingAdsApiBundle provides a simple integration of the Bing Ads API for your Symfony project.

Checkout the Bing Ads full documentation

Warning: Currently in development

Build Status Scrutinizer Code Quality Code Coverage

TODO

  • Create more Reports

Installation

With composer, add:

{
    "require": {
        "werkspot/bing-ads-api-bundle": "dev-master"
    }
}

Then enable it in your kernel:

// app/AppKernel.php
public function registerBundles()
{
    $bundles = [
        //...
        new Werkspot\BingAdsApiBundle\WerkspotBingAdsApiBundle(),
        //...

Configuration

# app/config/config.yml

# Bing ads API
werkspot_bing_ads_api:
  cache_dir: "%kernel.cache_dir%" #<-- optional

Usage

The bundle registers the werkspot.bing_ads_api_client service witch allows you to call the api;

Get Report

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

Credits

BingAdsApiBundle is based on the officical Bing Ads API. BingAdsApiBundle has been developed by LauLaman.