PHPackages                             spotonlive/laravel-google-ads - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. spotonlive/laravel-google-ads

ActiveLibrary[API Development](/categories/api)

spotonlive/laravel-google-ads
=============================

Google Ads API for Laravel

2.1(4y ago)6391.1k56[4 issues](https://github.com/spotonlive/laravel-google-ads/issues)[1 PRs](https://github.com/spotonlive/laravel-google-ads/pulls)MITPHPPHP &gt;=5.5.9

Since Dec 22Pushed 3y ago17 watchersCompare

[ Source](https://github.com/spotonlive/laravel-google-ads)[ Packagist](https://packagist.org/packages/spotonlive/laravel-google-ads)[ Docs](https://github.com/nikolajlovenhardt/laravel-google-ads)[ RSS](/packages/spotonlive-laravel-google-ads/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (28)Used By (0)

[![](https://cloud.githubusercontent.com/assets/3541622/17292148/47c841ea-57e8-11e6-80c3-773dfd28a1f4.png)](https://cloud.githubusercontent.com/assets/3541622/17292148/47c841ea-57e8-11e6-80c3-773dfd28a1f4.png)

[![Laravel 5.1+](https://camo.githubusercontent.com/76ed6178a9d1d7e17c1da213a9c37a398abb69170778cc94423577abdc0b52f7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e332b2d6f72616e67652e7376673f7374796c653d666c61742d737175617265)](http://laravel.com) [![Lumen 5.1+](https://camo.githubusercontent.com/d2c89c4b069e93afa2004d340c606134064e60625cead6f6c91e7543e0600481/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c756d656e2d352e332b2d6f72616e67652e7376673f7374796c653d666c61742d737175617265)](http://lumen.laravel.com) [![Total Downloads](https://camo.githubusercontent.com/60900607a08c900eebb81ebb29426397a86e75f7988c2df7fcb5f3b5625eb2a2/68747470733a2f2f706f7365722e707567782e6f72672f73706f746f6e6c6976652f6c61726176656c2d676f6f676c652d6164732f646f776e6c6f616473)](https://packagist.org/packages/spotonlive/laravel-google-ads) [![License](https://camo.githubusercontent.com/f1a16bacb06255e3ee61e04ceafefe66a7bf444b9e4bd2496e67b6cedf4c594f/68747470733a2f2f706f7365722e707567782e6f72672f73706f746f6e6c6976652f6c61726176656c2d676f6f676c652d6164732f6c6963656e7365)](https://packagist.org/packages/spotonlive/laravel-google-ads) [![Build Status](https://camo.githubusercontent.com/d9327d6803806834e0d71182723f75913066fbd01f841771c6b79be0fb604fd2/68747470733a2f2f7472617669732d63692e6f72672f73706f746f6e6c6976652f6c61726176656c2d676f6f676c652d6164732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/spotonlive/laravel-google-ads) [![Code Climate](https://camo.githubusercontent.com/3ab3108370e1c613ea839f892b69f13113d27ad9bac66bdc0b0900af3aa8c10f/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f73706f746f6e6c6976652f6c61726176656c2d676f6f676c652d6164732f6261646765732f6770612e737667)](https://codeclimate.com/github/spotonlive/laravel-google-ads) [![Test Coverage](https://camo.githubusercontent.com/4c358fa2d6ee55328d1d5b9d5ff11136fd97f7fd6e3b2bf33be60d19360a98e6/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f73706f746f6e6c6976652f6c61726176656c2d676f6f676c652d6164732f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/spotonlive/laravel-google-ads/coverage)

Google Ads API for Laravel
--------------------------

[](#google-ads-api-for-laravel)

Integration of [`googleads/googleads-php-lib`](https://github.com/googleads/googleads-php-lib) in Laravel and Lumen (version &gt;5).

### Setup

[](#setup)

- Run `$ composer require spotonlive/laravel-google-ads`

#### Laravel

[](#laravel)

- **(Only for Laravel 5.4 or minor)** Add provider to config/app.php

```
'providers' => [
    LaravelGoogleAds\LaravelGoogleAdsProvider::class,
],
```

- Run `$ php artisan vendor:publish` to publish the configuration file `config/google-ads.php` and insert:
    - developerToken
    - clientId &amp; clientSecret
    - refreshToken

#### Lumen

[](#lumen)

- Add provider to `bootstrap/app.php`

```
$app->register(LaravelGoogleAds\LaravelGoogleAdsProvider::class);
```

- Copy `vendor/spotonlive/laravel-google-ads/config/config.php` to `config/google-ads.php` and insert:

    - developerToken
    - clientId &amp; clientSecret
    - refreshToken
- Add config to `bootstrap/app.php`

```
$app->configure('google-ads');
```

### Generate refresh token

[](#generate-refresh-token)

*This requires that the `clientId` and `clientSecret` is from a native application.*

Run `$ php artisan googleads:token:generate` and open the authorization url. Grant access to the app, and input the access token in the console. Copy the refresh token into your configuration `config/google-ads.php`

### Basic usage

[](#basic-usage)

The following example is for AdWords, but the general code applies to all products.

```
