Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ language: php
php:
- 8.1
- 8.2
- 8.3
- 8.4
- nightly

matrix:
allow_failures:
- php: 8.4
- php: nightly

branches:
Expand Down
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
## 28.0.0
* Compatibility with v20.0 of the API: https://developers.google.com/google-ads/api/docs/release-notes

## 27.2.0
* Removed support for v17 of the API: https://ads-developers.googleblog.com/2025/04/google-ads-api-v17-sunset-reminder.html

## 26.2.0
* Compatibility with v19.1 of the API: https://developers.google.com/google-ads/api/docs/release-notes

## 26.1.0
* Added support for v19 of Google Ads API.
* Removed support for Feed-related classes, fields and enums in v19.
* Updated code examples:
* AddPerformanceMaxCampaign
* AddPerformanceMaxRetailCampaign
* AddShoppingProductAd
* GetChangeDetails

## 26.0.0
* Removed support for v16 of Google Ads API.

## 25.0.0
* Added support for v18 of Google Ads API.
* Removed support for the `useGapicV2Source` configuration, as the source code
of all versions are generated as GAPIC v2.
* Fixed the LaravelSampleApp to use GAPIC v2.
* Updated code examples:
* GetAllDisapprovedAds
* HandlePartialFailure

## 24.0.0
* Added support for v17_1 of Google Ads API.
* Removed support for v15 of Google Ads API.
* Made service client classes non-final.
* Added support for setting a REST handler as a client option for each call.

## 23.1.0
* Added support for v17 of Google Ads API.
* Updated code examples for removing the usage of `pageSize`:
Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Google Ads API v14 is [scheduled to be sunset by the end of May 2024](https://de
[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`:
* **gRPC**: To install the gRPC PHP extension, make sure to meet any additional requirements listed in the project's [**documentation**](https://cloud.google.com/php/grpc#installing_the_grpc_extension). 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`.
1. Add a line `extension=grpc.so` to the `php.ini` file.
1. Run `php -i | grep grpc` in a terminal: it is well installed
Expand Down Expand Up @@ -142,7 +142,7 @@ Follow the below steps if you want to try our code examples.
### 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/HEAD/src/Google/Ads/GoogleAds/Lib/V17/GoogleAdsClient.php).
[GoogleAdsClient](https://github.com/googleads/google-ads-php/blob/HEAD/src/Google/Ads/GoogleAds/Lib/V20/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).
Expand All @@ -152,12 +152,6 @@ For more information on how to configure a client when instantiating it, see the
Once you have an instance of `GoogleAdsClient`, you can obtain a service client
for a particular service using one of the `get...ServiceClient()` methods.

The created service client can be either GAPIC (Generated API Client) v1 or v2 source code, based
on the value of the `useGapicV2Source` configuration.
See [GAPIC](https://developers.devsite.corp.google.com/google-ads/api/docs/client-libs/php/gapic)
and [Configuration fields](https://developers.devsite.corp.google.com/google-ads/api/docs/client-libs/php/configuration#config-field)
for details.

## Client configuration

See the [Configuration guide](https://developers.google.com/google-ads/api/docs/client-libs/php/configuration).
Expand Down
18 changes: 6 additions & 12 deletions examples/AccountManagement/CreateCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
use GetOpt\GetOpt;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentNames;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentParser;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsException;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsException;
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;
use Google\Ads\GoogleAds\V17\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V17\Resources\Customer;
use Google\Ads\GoogleAds\V17\Services\CreateCustomerClientRequest;
use Google\Ads\GoogleAds\V20\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V20\Resources\Customer;
use Google\Ads\GoogleAds\V20\Services\CreateCustomerClientRequest;
use Google\ApiCore\ApiException;

/**
Expand Down Expand Up @@ -57,12 +57,6 @@ public static function main()
// OAuth2 credentials above.
$googleAdsClient = (new GoogleAdsClientBuilder())->fromFile()
->withOAuth2Credential($oAuth2Credential)
// We set this value to true to show how to use GAPIC v2 source code. You can remove the
// below line if you wish to use the old-style source code. Note that in that case, you
// probably need to modify some parts of the code below to make it work.
// For more information, see
// https://developers.devsite.corp.google.com/google-ads/api/docs/client-libs/php/gapic.
->usingGapicV2Source(true)
->build();

try {
Expand Down
32 changes: 10 additions & 22 deletions examples/AccountManagement/GetAccountHierarchy.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
use Google\Ads\GoogleAds\Examples\Utils\ArgumentNames;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentParser;
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsException;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsServerStreamDecorator;
use Google\Ads\GoogleAds\V17\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V17\Resources\CustomerClient;
use Google\Ads\GoogleAds\V17\Services\CustomerServiceClient;
use Google\Ads\GoogleAds\V17\Services\GoogleAdsRow;
use Google\Ads\GoogleAds\V17\Services\ListAccessibleCustomersRequest;
use Google\Ads\GoogleAds\V17\Services\SearchGoogleAdsStreamRequest;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsException;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsServerStreamDecorator;
use Google\Ads\GoogleAds\V20\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V20\Resources\CustomerClient;
use Google\Ads\GoogleAds\V20\Services\CustomerServiceClient;
use Google\Ads\GoogleAds\V20\Services\GoogleAdsRow;
use Google\Ads\GoogleAds\V20\Services\ListAccessibleCustomersRequest;
use Google\Ads\GoogleAds\V20\Services\SearchGoogleAdsStreamRequest;
use Google\ApiCore\ApiException;

/**
Expand Down Expand Up @@ -85,12 +85,6 @@ public static function main()
// OAuth2 credentials above.
$googleAdsClient = (new GoogleAdsClientBuilder())->fromFile()
->withOAuth2Credential($oAuth2Credential)
// We set this value to true to show how to use GAPIC v2 source code. You can remove the
// below line if you wish to use the old-style source code. Note that in that case, you
// probably need to modify some parts of the code below to make it work.
// For more information, see
// https://developers.devsite.corp.google.com/google-ads/api/docs/client-libs/php/gapic.
->usingGapicV2Source(true)
->build();

try {
Expand Down Expand Up @@ -210,12 +204,6 @@ private static function createCustomerClientToHierarchy(
$googleAdsClient = (new GoogleAdsClientBuilder())->fromFile()
->withOAuth2Credential($oAuth2Credential)
->withLoginCustomerId($loginCustomerId ?? $rootCustomerId)
// We set this value to true to show how to use GAPIC v2 source code. You can remove the
// below line if you wish to use the old-style source code. Note that in that case, you
// probably need to modify some parts of the code below to make it work.
// For more information, see
// https://developers.devsite.corp.google.com/google-ads/api/docs/client-libs/php/gapic.
->usingGapicV2Source(true)
->build();

// Creates the Google Ads Service client.
Expand Down
40 changes: 9 additions & 31 deletions examples/AccountManagement/GetChangeDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
use Google\Ads\GoogleAds\Examples\Utils\ArgumentNames;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentParser;
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsException;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsException;
use Google\Ads\GoogleAds\Util\FieldMasks;
use Google\Ads\GoogleAds\V17\Enums\ChangeClientTypeEnum\ChangeClientType;
use Google\Ads\GoogleAds\V17\Enums\ChangeEventResourceTypeEnum\ChangeEventResourceType;
use Google\Ads\GoogleAds\V17\Enums\ResourceChangeOperationEnum\ResourceChangeOperation;
use Google\Ads\GoogleAds\V17\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V17\Services\GoogleAdsRow;
use Google\Ads\GoogleAds\V17\Services\SearchGoogleAdsRequest;
use Google\Ads\GoogleAds\V20\Enums\ChangeClientTypeEnum\ChangeClientType;
use Google\Ads\GoogleAds\V20\Enums\ChangeEventResourceTypeEnum\ChangeEventResourceType;
use Google\Ads\GoogleAds\V20\Enums\ResourceChangeOperationEnum\ResourceChangeOperation;
use Google\Ads\GoogleAds\V20\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V20\Services\GoogleAdsRow;
use Google\Ads\GoogleAds\V20\Services\SearchGoogleAdsRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\Internal\Message;
use Google\Protobuf\Internal\RepeatedField;
Expand Down Expand Up @@ -62,12 +62,6 @@ public static function main()
// OAuth2 credentials above.
$googleAdsClient = (new GoogleAdsClientBuilder())->fromFile()
->withOAuth2Credential($oAuth2Credential)
// We set this value to true to show how to use GAPIC v2 source code. You can remove the
// below line if you wish to use the old-style source code. Note that in that case, you
// probably need to modify some parts of the code below to make it work.
// For more information, see
// https://developers.devsite.corp.google.com/google-ads/api/docs/client-libs/php/gapic.
->usingGapicV2Source(true)
->build();

try {
Expand Down Expand Up @@ -210,26 +204,10 @@ public static function runExample(GoogleAdsClient $googleAdsClient, int $custome
$oldResourceEntity = $oldResource->getCampaignCriterion();
$newResourceEntity = $newResource->getCampaignCriterion();
break;
case ChangeEventResourceType::AD_GROUP_FEED:
$oldResourceEntity = $oldResource->getAdGroupFeed();
$newResourceEntity = $newResource->getAdGroupFeed();
break;
case ChangeEventResourceType::CAMPAIGN_FEED:
$oldResourceEntity = $oldResource->getCampaignFeed();
$newResourceEntity = $newResource->getCampaignFeed();
break;
case ChangeEventResourceType::CUSTOMER_ASSET:
$oldResourceEntity = $oldResource->getCustomerAsset();
$newResourceEntity = $newResource->getCustomerAsset();
break;
case ChangeEventResourceType::FEED:
$oldResourceEntity = $oldResource->getFeed();
$newResourceEntity = $newResource->getFeed();
break;
case ChangeEventResourceType::FEED_ITEM:
$oldResourceEntity = $oldResource->getFeedItem();
$newResourceEntity = $newResource->getFeedItem();
break;
default:
$isResourceTypeKnown = false;
break;
Expand Down
24 changes: 9 additions & 15 deletions examples/AccountManagement/GetChangeSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
use GetOpt\GetOpt;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentNames;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentParser;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsException;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsException;
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;
use Google\Ads\GoogleAds\V17\Enums\ChangeStatusOperationEnum\ChangeStatusOperation;
use Google\Ads\GoogleAds\V17\Enums\ChangeStatusResourceTypeEnum\ChangeStatusResourceType;
use Google\Ads\GoogleAds\V17\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V17\Resources\ChangeStatus;
use Google\Ads\GoogleAds\V17\Services\GoogleAdsRow;
use Google\Ads\GoogleAds\V17\Services\SearchGoogleAdsRequest;
use Google\Ads\GoogleAds\V20\Enums\ChangeStatusOperationEnum\ChangeStatusOperation;
use Google\Ads\GoogleAds\V20\Enums\ChangeStatusResourceTypeEnum\ChangeStatusResourceType;
use Google\Ads\GoogleAds\V20\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V20\Resources\ChangeStatus;
use Google\Ads\GoogleAds\V20\Services\GoogleAdsRow;
use Google\Ads\GoogleAds\V20\Services\SearchGoogleAdsRequest;
use Google\ApiCore\ApiException;

/**
Expand All @@ -57,12 +57,6 @@ public static function main()
// OAuth2 credentials above.
$googleAdsClient = (new GoogleAdsClientBuilder())->fromFile()
->withOAuth2Credential($oAuth2Credential)
// We set this value to true to show how to use GAPIC v2 source code. You can remove the
// below line if you wish to use the old-style source code. Note that in that case, you
// probably need to modify some parts of the code below to make it work.
// For more information, see
// https://developers.devsite.corp.google.com/google-ads/api/docs/client-libs/php/gapic.
->usingGapicV2Source(true)
->build();

try {
Expand Down
22 changes: 8 additions & 14 deletions examples/AccountManagement/InviteUserWithAccessRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
use Google\Ads\GoogleAds\Examples\Utils\ArgumentNames;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentParser;
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsException;
use Google\Ads\GoogleAds\V17\Enums\AccessRoleEnum\AccessRole;
use Google\Ads\GoogleAds\V17\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V17\Resources\CustomerUserAccessInvitation;
use Google\Ads\GoogleAds\V17\Services\CustomerUserAccessInvitationOperation;
use Google\Ads\GoogleAds\V17\Services\MutateCustomerUserAccessInvitationRequest;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsException;
use Google\Ads\GoogleAds\V20\Enums\AccessRoleEnum\AccessRole;
use Google\Ads\GoogleAds\V20\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V20\Resources\CustomerUserAccessInvitation;
use Google\Ads\GoogleAds\V20\Services\CustomerUserAccessInvitationOperation;
use Google\Ads\GoogleAds\V20\Services\MutateCustomerUserAccessInvitationRequest;
use Google\ApiCore\ApiException;

/**
Expand Down Expand Up @@ -65,12 +65,6 @@ public static function main()
// OAuth2 credentials above.
$googleAdsClient = (new GoogleAdsClientBuilder())->fromFile()
->withOAuth2Credential($oAuth2Credential)
// We set this value to true to show how to use GAPIC v2 source code. You can remove the
// below line if you wish to use the old-style source code. Note that in that case, you
// probably need to modify some parts of the code below to make it work.
// For more information, see
// https://developers.devsite.corp.google.com/google-ads/api/docs/client-libs/php/gapic.
->usingGapicV2Source(true)
->build();

try {
Expand Down
32 changes: 13 additions & 19 deletions examples/AccountManagement/LinkManagerToClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@
use Google\Ads\GoogleAds\Examples\Utils\ArgumentNames;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentParser;
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V17\GoogleAdsException;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V20\GoogleAdsException;
use Google\Ads\GoogleAds\Util\FieldMasks;
use Google\Ads\GoogleAds\Util\V17\ResourceNames;
use Google\Ads\GoogleAds\V17\Enums\ManagerLinkStatusEnum\ManagerLinkStatus;
use Google\Ads\GoogleAds\V17\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V17\Resources\CustomerClientLink;
use Google\Ads\GoogleAds\V17\Resources\CustomerManagerLink;
use Google\Ads\GoogleAds\V17\Services\CustomerClientLinkOperation;
use Google\Ads\GoogleAds\V17\Services\CustomerManagerLinkOperation;
use Google\Ads\GoogleAds\V17\Services\MutateCustomerClientLinkRequest;
use Google\Ads\GoogleAds\V17\Services\MutateCustomerManagerLinkRequest;
use Google\Ads\GoogleAds\V17\Services\SearchGoogleAdsRequest;
use Google\Ads\GoogleAds\Util\V20\ResourceNames;
use Google\Ads\GoogleAds\V20\Enums\ManagerLinkStatusEnum\ManagerLinkStatus;
use Google\Ads\GoogleAds\V20\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V20\Resources\CustomerClientLink;
use Google\Ads\GoogleAds\V20\Resources\CustomerManagerLink;
use Google\Ads\GoogleAds\V20\Services\CustomerClientLinkOperation;
use Google\Ads\GoogleAds\V20\Services\CustomerManagerLinkOperation;
use Google\Ads\GoogleAds\V20\Services\MutateCustomerClientLinkRequest;
use Google\Ads\GoogleAds\V20\Services\MutateCustomerManagerLinkRequest;
use Google\Ads\GoogleAds\V20\Services\SearchGoogleAdsRequest;
use Google\ApiCore\ApiException;

/**
Expand Down Expand Up @@ -288,12 +288,6 @@ private static function createGoogleAdsClient(int $loginCustomerId)
->withOAuth2Credential($oAuth2Credential)
// Overrides the login customer ID with the given one.
->withLoginCustomerId($loginCustomerId)
// We set this value to true to show how to use GAPIC v2 source code. You can remove the
// below line if you wish to use the old-style source code. Note that in that case, you
// probably need to modify some parts of the code below to make it work.
// For more information, see
// https://developers.devsite.corp.google.com/google-ads/api/docs/client-libs/php/gapic.
->usingGapicV2Source(true)
->build();
}
}
Expand Down
Loading
Loading