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"
Ensure the following .env variables are set:
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
GOOGLE_DEVELOPER_TOKEN=""
GOOGLE_LOGIN_CUSTOMER_ID=""
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: ^7.3|^8.0
Google Ads PHP SDK versions: ^11.0
(V8)
Check out the CHANGELOG in this repository for all the recent changes.
Developed and maintained by Joel Butcher
You can view all contributers here
This pacakge is open-sourced software licensed under the MIT license.