PHP code example of joelbutcher / laravel-googleads

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

    

joelbutcher / laravel-googleads example snippets


/*
* Package Service Providers...
*/
\JoelButcher\LaravelGoogleAds\ServiceProvider::class,



return [
    'google' => [
        'client_id' => env('GOOGLE_CLIENT_ID'),
        'client_secret' => env('GOOGLE_CLIENT_SECRET'),
    ],
    
    'google_ads' => [
        'developer_token' => env('GOOGLE_ADS_DEVELOPER_TOKEN'),
        'sdk_version' => env('GOOGLE_ADS_VERSION'),
    ],
];



use JoelButcher\GoogleAds\GoogleAds;

class MyClass
{
    public function __construct(private GoogleAds $googleAds) {}
}

// As yourself
$this->googleAds->authorize($refreshToken);

// As an MCC on behalf of a managed customer
$this->googleAds->authorize($refreshToken, $customerId);

// Campaign Service
$service = $this->googleAds->getCampaignServiceClient();
sh
php artisan vendor:publish --provider="JoelButcher\LaravelGoogleAds\ServiceProvider"