A Laravel wrapper for the Google Ads Api Client OAuth2 Wrapper.
Install the package via composer:
composer require joelbutcher/laravel-googleads
Add the service provider to your package service providers in config/app.php
:
/*
* Package Service Providers...
*/
\JoelButcher\LaravelGoogleAds\ServiceProvider::class,
Then publish the config file:
php artisan vendor:publish --provider="JoelButcher\LaravelGoogleAds\ServiceProvider"
Update your services.php config file with the following
<?php
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'),
],
];
To use the Google Ads Service, you may inject the service into the constructor of your class, like below:
<?php
use JoelButcher\GoogleAds\GoogleAds;
class MyClass
{
public function __construct(private GoogleAds $googleAds) {}
}
You may then call any of the methods found on the wrapped Google Ads Client
// 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();
PHP supported version: ^8.0
Google Ads PHP SDK versions: ^19.0
(V12, V13)
Developed and maintained by Joel Butcher
You can view all contributors here
This package is open-sourced software licensed under the MIT license.