PHPackages                             triwinvendor/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. triwinvendor/google-ads

ActiveLibrary[API Development](/categories/api)

triwinvendor/google-ads
=======================

Google Ads API client for PHP

1.0.6(3y ago)032Apache-2.0PHPPHP &gt;=7.2

Since Sep 28Pushed 3y agoCompare

[ Source](https://github.com/TriwinVendor/google-ads)[ Packagist](https://packagist.org/packages/triwinvendor/google-ads)[ Docs](https://github.com/googleads/google-ads-php)[ RSS](/packages/triwinvendor-google-ads/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (3)Dependencies (9)Versions (7)Used By (0)

Google Ads API Client Library for PHP
=====================================

[](#google-ads-api-client-library-for-php)

[![Minimum PHP Version](https://camo.githubusercontent.com/eed4d5cf01364b115489810f47ed4b33191d997e7ab4014f3daff1c09fbae7d9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e332d3838393242462e737667)](https://www.php.net/supported-versions.php)[![Latest Stable Version](https://camo.githubusercontent.com/7162410daa2effad449541c56d43a890ae364a1df36db9e4a48d527b78782e3a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676f6f676c656164732f676f6f676c652d6164732d7068702e737667)](https://packagist.org/packages/googleads/google-ads-php)[![Total Downloads](https://camo.githubusercontent.com/906c10d95b9d85dd7c285931f060287a9f86203035b532ab7c970604e2b58cfd/68747470733a2f2f706f7365722e707567782e6f72672f676f6f676c656164732f676f6f676c652d6164732d7068702f646f776e6c6f6164732e737667)](https://packagist.org/packages/googleads/google-ads-php)[![License](https://camo.githubusercontent.com/31e91c4fc86606e73d5d6780ce24b35ffa958eac3825553459c2a47d397ead4a/68747470733a2f2f706f7365722e707567782e6f72672f676f6f676c656164732f676f6f676c652d6164732d7068702f6c6963656e73652e737667)](https://packagist.org/packages/googleads/google-ads-php)

[![Build Status](https://camo.githubusercontent.com/21edfa5fa16559848cd84aeb9f4dfd3f4d1669ef282b637a2e31d958d4715dc1/68747470733a2f2f7472617669732d63692e6f72672f676f6f676c656164732f676f6f676c652d6164732d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/googleads/google-ads-php)[![codecov](https://camo.githubusercontent.com/87c90c569a40134a12b6d8cc1e1870731d74de6e08cf5fb402c659fb0285084f/68747470733a2f2f636f6465636f762e696f2f67682f676f6f676c656164732f676f6f676c652d6164732d7068702f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/googleads/google-ads-php)

This project hosts the PHP client library for the [Google Ads API](https://developers.google.com/google-ads/api/docs/start).

Features
--------

[](#features)

- Distributed via [Composer](https://getcomposer.org/) and [Packagist](https://packagist.org/packages/googleads/google-ads-php).
- Easy management of credentials.
- Easy creation of Google Ads API service clients.

Requirements
------------

[](#requirements)

- This library depends on [Composer](https://getcomposer.org/). If you don't have it installed on your computer yet, follow the [installation guide for Linux/Unix/OS X](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx) or [installation guide for Windows](https://getcomposer.org/doc/00-intro.md#installation-windows). For the rest of this guide, we're assuming that you're using Linux/Unix/OS X and have Composer installed [globally](https://getcomposer.org/doc/00-intro.md#globally), thus, your installed Composer is available on the command line as `composer`.
- System requirements and dependencies can be found in [composer.json](composer.json) of this library.
    - **PHP**: You can find the required minimum PHP version in `"php"` under the [**`require`**](https://getcomposer.org/doc/01-basic-usage.md#the-require-key) key of [`composer.json`](composer.json). We usually set it to the minimum PHP version for which the PHP development team still provide security fixes. Whenever such a version is sunset, we'll update the composer file accordingly. Currently, the update frequency is around once a year based on the [official schedule](https://www.php.net/supported-versions.php). Visit [this page](https://www.php.net/manual/en/getting-started.php) for introduction to PHP.
    - **gRPC**: To install the gRPC PHP extension, make sure to meet any additional requirements listed in the project's [**documentation**](https://grpc.io/docs/languages/php/quickstart/#prerequisites). You can learn more about how gRPC is used by this library by reading our [Transport](https://developers.google.com/google-ads/api/docs/client-libs/php/transport) guide. It usually take minutes to install using `PECL`:
        1. Install the extension using the command `sudo pecl install grpc`.
        2. Add a line `extension=grpc.so` to the `php.ini` file.
        3. Run `php -i | grep grpc` in a terminal: it is well installed and configured if it returns something
    - **Protobuf**: To install the Protobuf PHP extension, make sure to meet any additional requirements listed in the project's [**documentation**](https://github.com/protocolbuffers/protobuf/tree/master/php#requirements). If you encounter any error during the installation, you can skip this step and the PHP implementation will be used instead. You can learn more about how Protobuf is used by this library by reading our [Protobuf implementations](https://developers.google.com/google-ads/api/docs/client-libs/php/protobuf) guide. It usually take minutes to install using `PECL`:
        1. Install the extension using the command `sudo pecl install protobuf`.
        2. Add a line `extension=protobuf.so` to the `php.ini` file.
        3. Run `php -i | grep protobuf` in a terminal: it is well installed and configured if it returns something
- You need a [developer token](https://developers.google.com/google-ads/api/docs/first-call/dev-token)to connect to the Google Ads API.
- One version of the library typically supports multiple versions of the Google Ads API. You can check the [CHANGELOG.md](https://github.com/googleads/google-ads-php/blob/master/CHANGELOG.md) file to identify what versions of the library added or removed the support for a specific version of the Google Ads API. For example, the version `V7` of the Google Ads API was added in the version `v9.0.0` of the library as described [here](https://github.com/googleads/google-ads-php/blob/master/CHANGELOG.md#900).

Getting started
---------------

[](#getting-started)

1. Clone this project in the directory of your choice via:

    ```
    git clone https://github.com/googleads/google-ads-php.git

    ```
2. Change into the `google-ads-php` directory.

    ```
    cd google-ads-php

    ```

    You'll see some files and subdirectories:

    - `composer.json`: the composer file, which holds the requirements of this library.
    - `src`: source code of the library.
    - `tests`: tests of the library code.
    - `examples`: many examples that demonstrate how to use the library to execute common use cases via the Google Ads API.
    - `metadata`: some metadata files used internally by the source code. They're automatically generated files, so you shouldn't modify them.
3. Run `composer install` at the command prompt. This will install all dependencies needed for using the library and running examples.
4. Set up your OAuth2 credentials.

    The Google Ads API uses [OAuth2](http://oauth.net/2/) as the authentication mechanism. Choose the appropriate option below based on your use case, and read and follow the instructions that the example prints to the console.

    **If you already have credentials for the AdWords API...**

    - If you have the `adsapi_php.ini` file you used for the AdWords API, copy and name it as `google_ads_php.ini`. Simply change the section name from `[ADWORDS]` to `[GOOGLE_ADS]`.
    - If you don't have the file, copy the sample `google_ads_php.ini` to your [home directory](https://en.wikipedia.org/wiki/Home_directory#Default_home_directory_per_operating_system). This library determines the home directory of your computer by using [`EnvironmentalVariables::getHome()`](https://github.com/googleads/google-ads-php/blob/master/src/Google/Ads/GoogleAds/Util/EnvironmentalVariables.php#L36).

    **If you're accessing the Google Ads API using your own credentials...**

    - Copy the sample [`google_ads_php.ini`](examples/Authentication/google_ads_php.ini)to your [home directory](https://en.wikipedia.org/wiki/Home_directory#Default_home_directory_per_operating_system). This library determines the home directory of your computer by using [`EnvironmentalVariables::getHome()`](https://github.com/googleads/google-ads-php/blob/master/src/Google/Ads/GoogleAds/Util/EnvironmentalVariables.php#L36).
    - Follow the instructions at  to create an OAuth2 client ID and secret for the **installed application**OAuth2 flow.
    - Run the [AuthenticateInDesktopApplication](https://github.com/googleads/google-ads-php/blob/master/examples/Authentication/AuthenticateInDesktopApplication.php)example, which will prompt you for your OAuth2 client ID and secret.
    - Copy the output from the last step of the example into the `google_ads_php.ini` file in your home directory. Don't forget to fill in your developer token too.
5. Run the [GetCampaigns example](examples/BasicOperations/GetCampaigns.php) to test if your credentials are valid. You also need to pass your Google Ads account's customer ID without dashes as a command-line parameter:

    ```
    php examples/BasicOperations/GetCampaigns.php --customerId

    ```

    **NOTE**: Code examples are meant to be run from command prompt, not via the web browsers.
6. Explore other examples.

    The [examples](examples) directory contains several useful examples. Most of the examples require parameters. You can see what are required by running code examples with `--help` as a command-line parameter.

    **Note:** You will find comments with the formats `[START...]` and `[END...]`in the source code of these examples. These are only used for technical purposes, you can completely disregard them.

Basic usage
-----------

[](#basic-usage)

### Instantiate a client

[](#instantiate-a-client)

To issue requests via the Google Ads API, you first need to create a [GoogleAdsClient](https://github.com/googleads/google-ads-php/blob/master/src/Google/Ads/GoogleAds/Lib/V8/GoogleAdsClient.php).

For more information on how to configure a client when instantiating it, see the [configuration guide](https://developers.google.com/google-ads/api/docs/client-libs/php/configuration).

### Get a service client

[](#get-a-service-client)

Once you have an instance of `GoogleAdsClient`, you can obtain a service client for a particular service using one of the `get...ServiceClient()` methods.

Client configuration
--------------------

[](#client-configuration)

See the [Configuration guide](https://developers.google.com/google-ads/api/docs/client-libs/php/configuration).

Transport
---------

[](#transport)

There are different types of transport that can be used. See the [Transport guide](https://developers.google.com/google-ads/api/docs/client-libs/php/transport)for more information.

Protobuf
--------

[](#protobuf)

[Protobuf](https://developers.google.com/protocol-buffers/docs/overview) is used regardless of the transport used to request the Google Ads API.

See the [Protobuf guide](https://developers.google.com/google-ads/api/docs/client-libs/php/protobuf)for more information.

Running in a Docker container
-----------------------------

[](#running-in-a-docker-container)

See the [Running in a Docker container guide](https://developers.google.com/google-ads/api/docs/client-libs/php/docker).

Logging
-------

[](#logging)

See the [Logging guide](https://developers.google.com/google-ads/api/docs/client-libs/php/logging).

Proxy configuration
-------------------

[](#proxy-configuration)

See the [Proxy guide](https://developers.google.com/google-ads/api/docs/client-libs/php/proxy).

Performance
-----------

[](#performance)

See the [Performance guide](https://developers.google.com/google-ads/api/docs/client-libs/php/performance).

Miscellaneous
-------------

[](#miscellaneous)

### Wiki

[](#wiki)

-

### Issue tracker

[](#issue-tracker)

-

### API Documentation:

[](#api-documentation)

-

### Support forum

[](#support-forum)

-

### Authors

[](#authors)

- [Thanet Knack Praneenararat](https://github.com/fiboknacky)
- [Mattia Tommasone](https://github.com/Raibaz)
- [Pierrick Voulet](https://github.com/PierrickVoulet)

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

6

Last Release

1309d ago

PHP version history (3 changes)1.0.2PHP ^7.3|^8.0

1.0.4PHP &gt;=7.4

1.0.5PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/80bd3956c4cc9bc2e115d3ad0f7cb8c548541969ccb16bd3082feec1cf56e756?d=identicon)[yu](/maintainers/yu)

---

Top Contributors

[![QAQsugar](https://avatars.githubusercontent.com/u/36018735?v=4)](https://github.com/QAQsugar "QAQsugar (3 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/triwinvendor-google-ads/health.svg)

```
[![Health](https://phpackages.com/badges/triwinvendor-google-ads/health.svg)](https://phpackages.com/packages/triwinvendor-google-ads)
```

###  Alternatives

[googleads/google-ads-php

Google Ads API client for PHP

3497.6M9](/packages/googleads-google-ads-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)[google/grpc-gcp

gRPC GCP library for channel management

18497.8M3](/packages/google-grpc-gcp)[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k379.4k24](/packages/team-reflex-discord-php)[spiral/grpc-client

gRPC client

41140.3k2](/packages/spiral-grpc-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
