Skip to content

Laravel Service Provider for the Google Ads Client OAuth2 Wrapper

License

Notifications You must be signed in to change notification settings

joelbutcher/laravel-googleads

Repository files navigation

Laravel Google Ads

Total Downloads Latest Stable Version License

A Laravel wrapper for the Google Ads Api Client OAuth2 Wrapper.

Installation

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'),
    ],
];

Usage

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();

Versioning

PHP supported version: ^8.0

Google Ads PHP SDK versions: ^19.0 (V12, V13)

Maintainers

Developed and maintained by Joel Butcher

Credits

You can view all contributors here

License

This package is open-sourced software licensed under the MIT license.

About

Laravel Service Provider for the Google Ads Client OAuth2 Wrapper

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages