PHP code example of grayscale / laravel-ads-sdk

1. Go to this page and download the library: Download grayscale/laravel-ads-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/ */

    

grayscale / laravel-ads-sdk example snippets


// The namespace to the Facade for laravel Ads SDK
use LaravelAds;

// calling Google Ads and including the Account ID
$googleAds = LaravelAds::googleAds()->with('ACCOUNT_ID');

// calling Bing Ads and including the Account ID
$bingAds = LaravelAds::bingAds()->with('ACCOUNT_ID');

// calling Facebook Ads and including the Account ID
$facebookAds = LaravelAds::facebookAds()->with('ACCOUNT_ID');

public function boot()
{
    LaravelAds\Services\BingAds\Service::macro('addUetTags', function($tags){
        $serviceCall = $this->call(ServiceClientType::CampaignManagementVersion13);

        try {
            $request = new AddUetTagsRequest();
            $request->UetTags = $tags;

            $serverResponse = $serviceCall->GetService()->AddUetTags($request);

            return $serverResponse;
        } catch (\Exception $e) {
            print $serviceCall->GetService()->__getLastRequest()."\n";
            print $serviceCall->GetService()->__getLastResponse()."\n";
        }
    });

    LaravelAds\Services\GoogleAds\Service::macro('dd', function(){
        dd($this);
    });
}

$bingAds = LaravelAds::bingAds()->addUetTags([
    [
        'Name' => 'Extensible!',
        'Description' => 'No PR Needed!',
    ]
]);

$bingAds = LaravelAds::googleAds()->dd();